Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Minor Change Proposal for Classe 'UnboundMethod'

Thread Tools

Minor Change Proposal for Classe 'UnboundMethod'

Wolfgang Nádasi-Donner
Posts: n/a
Minor Change Proposal for Classe 'UnboundMethod'
__________________________________________________ _____

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


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 for Workaround >>>>>

class UnboundMethod
def method_name
md = self.to_s.match(/Method:\s*([^#]+)#([^>]+)>/)
return md[1], md[2]

# Now an example

class Hugo
def hi
puts "An instance of Hugo says 'Hi!'"

my_hugo =
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)
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Minor Change Proposal]Allow back reference with nest level in Onigurumafor Ruby again Wolfgang Nádasi-Donner Ruby 1 05-15-2007 03:12 PM
Minor Change Proposal for Classes 'Object' and 'Method' Wolfgang Nádasi-Donner Ruby 3 01-30-2007 10:24 AM
Minor Change Proposal for Class 'Numeric' Wolfgang Nádasi-Donner Ruby 7 01-23-2007 12:10 AM
How - Convert Classe/DLL to Web Service? Zean Smith ASP .Net 3 08-31-2005 03:35 PM
Application do global.asax numa classe Alexandre Martins ASP .Net 0 08-15-2003 02:40 PM