W
Wolfgang Nádasi-Donner
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.
___________
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.methodhi)
unbound1 = myhi.unbind
unbound2 = Hugo.instance_methodhi)
p unbound1.method_name # => ["Hugo", "hi"]
p unbound2.method_name # => ["Hugo", "hi"]
___________
Wolfgang Nádasi-Donner (WoNáDo)
_______________________________________________________
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.
___________
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.methodhi)
unbound1 = myhi.unbind
unbound2 = Hugo.instance_methodhi)
p unbound1.method_name # => ["Hugo", "hi"]
p unbound2.method_name # => ["Hugo", "hi"]
___________
Wolfgang Nádasi-Donner (WoNáDo)