I am trying to get definition of method :foo from Class object.
class Bar
def foo(required_name, optional="something")
puts "Hello args are #{required_name}, #{optional}"
end
def self.bar
puts "I am easy, since I am static"
end
end
I cannot create instance of class since I need method definition to evaluate should I create object (app requirments). Bar.class.???(:foo)
I can get with bar definition with Bar.class.method(:bar) but of course I need foo, thanks!
UPDATE:
Using Ruby 1.8.7
You can use the method
instance_methodon a class like this :which will return an instance of
UnboundMethod. (See http://ruby-doc.org/core-1.9.3/UnboundMethod.html)