Hello,
From Ruby library reference manual, It tells that "define_method" is an
instance method of "class Module < Object", but why the following call give
out "false"
Module.instance_methods.include? :define_method
=> false
Thanks,
Brian
Hello,
From Ruby library reference manual, It tells that "define_method" is an
instance method of "class Module < Object", but why the following call give
out "false"
Module.instance_methods.include? :define_method
=> false
Thanks,
Brian
Hi,
Yes, a +define_method+ method is an instance method of the +Module+ class,
as you said. However, the method is PRIVATE [1], so you can't find it by using
your code.
Please use following code instead.
(on ruby 1.9.2-p180)
Mocdule.private_instance_methods.include? :define_method
=> true
[1] http://ruby-doc.org/core/classes/Module.html#M000497
Regards,
--
NOBUOKA Yu
Thank you very much for you help.
Brian
2011/5/12 Y. NOBUOKA <nobuoka@r-definition.com>
Hi,
Yes, a +define_method+ method is an instance method of the +Module+ class,
as you said. However, the method is PRIVATE [1], so you can't find it by
using
your code.
Please use following code instead.(on ruby 1.9.2-p180)
Mocdule.private_instance_methods.include? :define_method
=> true[1] class Module - RDoc Documentation
Regards,
--
NOBUOKA Yu