Hi all,
I would like to redefine a mofule function in a method, play with my module
and redefine this function with original one. I can't find a way to do this
because I can't open a module in a method.
···
--
Michel Casabianca
Hi all,
I would like to redefine a mofule function in a method, play with my module
and redefine this function with original one. I can't find a way to do this
because I can't open a module in a method.
--
Michel Casabianca
Not clear if you mean something like this:
module M
def m1; 1; end
end
class C1
include M
end
p C1.new.m1
class C2
include M
def redef
M.module_eval do
define_method(:m1) {2}
end
end
end
C2.new.redef
p C1.new.m1
/Robert
On 12/4/06, Michel Casabianca <michel.casabianca@gmail.com> wrote:
Hi all,
I would like to redefine a mofule function in a method, play with my module
and redefine this function with original one. I can't find a way to do this
because I can't open a module in a method.