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] class Module - RDoc Documentation
Regards,
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs