I have something like this:
module MyModule define_method(:foo){ puts "yeah!" } end class User include MyModule end
But this does not work as intended ... They are not defined. I also need to use a module because I want to distinguish methods from there from ordinary user methods. What I like:
MyModule.instance_methods
Please help .. what am I missing? I also tried:
module MyModule (class << self; self; end).class_eval do define_method(:foo){ puts "yeah!" } end end
which also does not work: /
to clarify ... I would like to use:
User.first.foo
not
MyModule.foo
source share