D
David Chelimsky
I've got the following:
module ClassMethods
def class_method
"Class method"
end
end
class Thing
extend ClassMethods
end
Thing.class_method
=> "Class method"
... and I want to change the behaviour of that method at runtime. I
tried this:
Thing.senddefine_method, :class_method, lambda{ "replaced" })
... but I still get this:
Thing.class_method
=> "Class method"
Am I close? What's the right way to do this?
Thanks,
David
module ClassMethods
def class_method
"Class method"
end
end
class Thing
extend ClassMethods
end
Thing.class_method
=> "Class method"
... and I want to change the behaviour of that method at runtime. I
tried this:
Thing.senddefine_method, :class_method, lambda{ "replaced" })
... but I still get this:
Thing.class_method
=> "Class method"
Am I close? What's the right way to do this?
Thanks,
David