# Prime mark for method wrapping

**URL:** <https://www.ruby-forum.com/t/prime-mark-for-method-wrapping/96631>\
**Category:** Ruby\
**Created:** [June 30, 2006, 11:55am UTC](https://www.ruby-forum.com/t/prime-mark-for-method-wrapping/96631 "2006-06-30T11:55:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 30, 2006, 11:55am UTC](https://www.ruby-forum.com/t/prime-mark-for-method-wrapping/96631/1 "2006-06-30T11:55:48Z")

</div>

Had a thought today about the idiom:

alias :foo\_without\_bar, :foo  
def foo  
…  
foo\_withiout\_bar  
…  
end

First let me point out that Rails recently invented a further bent on  
this:

def foo\_with\_bar  
…  
foo\_withiout\_bar  
…  
end

alias\_method\_chain :foo, :bar

The trick is the last method which is equivalent to:

alias\_method :foo\_without\_bar, :foo  
alias\_method :foo, :foo\_with\_bar

This new idiom is useful when including modules by adding it to the  
#included callback. This wookrs finr for the specialized use it gets in  
Rails, but it really has issues as a general solution. But I won’t go  
into that. That’s not the point of this thread.

This morning it occured to me that an elegant solution might be the use  
of a prime mark to do true method wraps:

def foo’  
…  
foo  
…  
end

This is essentially like matz ‘def foo:wrap’ but without the extraneous  
label. Of course matz hints at having some general use for that label,  
if so, I sure would like to know what it is.

Anyhow, just a thought.

T.
