# Minor Change Proposal for Classe 'UnboundMethod'

**URL:** <https://www.ruby-forum.com/t/minor-change-proposal-for-classe-unboundmethod/82691>\
**Category:** Ruby\
**Created:** [January 19, 2007, 6:55pm UTC](https://www.ruby-forum.com/t/minor-change-proposal-for-classe-unboundmethod/82691 "2007-01-19T18:55:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wonado](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/919ad9/32.png) [@wonado](https://www.ruby-forum.com/u/wonado)\
**Post date:** [January 19, 2007, 6:55pm UTC](https://www.ruby-forum.com/t/minor-change-proposal-for-classe-unboundmethod/82691/1 "2007-01-19T18:55:31Z")

</div>

Minor Change Proposal for Classe ‘UnboundMethod’

* * *

I would like to make a small change suggestion on the class  
‘UnboundMethod’.

Background:

* * *

The proposal is to add one or two additional methods for class  
‘UnboundMethod’,  
which return the contents of ‘UnboundMethod#to\_s’ as an two element  
Array or the  
parts by two independant methods.

The method name used by here is only a suggestion, since I need a names  
for the  
example.

* * *

> > > > > Example for Workaround \>\>\>\>\>  
> > > > > class UnboundMethod  
> > > > > def method\_name  
> > > > > md = self.to\_s.match(/Method:\s\*([^#]+)#([^\>]+)\>/)  
> > > > > return md[1], md[2]  
> > > > > end  
> > > > > end

# Now an example

class Hugo  
def hi  
puts “An instance of Hugo says ‘Hi!’”  
end  
end

my\_hugo = Hugo.new  
myhi = my\_hugo.method(:hi)  
unbound1 = myhi.unbind  
unbound2 = Hugo.instance\_method(:hi)

p unbound1.method\_name # =\> [“Hugo”, “hi”]  
p unbound2.method\_name # =\> [“Hugo”, “hi”]

> > > > > ```
> > > > > End of Example >>>>>
> > > > > 
> > > > > ```

* * *

Wolfgang Nádasi-Donner (WoNáDo)
