Is it possible to get a method object from a Module directly? This
doesn't work:
module Foo
def my_method
end
end
method = Foo.method(:my_method)
=> NameError: undefined method `my_method' for class `Module'
Is there a way to do what I mean?
Regards,
Dan
Kent.
m = Object.new.extend(Foo).method(:my_method)
Ryan
That works great. Thanks both.
Dan
Or you can bind unbound method:
Foo.instance_method(:my_method).bind(obj).call
matz.