Hi,
In message "Re: [ruby-core:25228] Re: Module#prepend and Array#prepend"
on Tue, 1 Sep 2009 03:24:30 +0900, Yusuke ENDOH <mame / tsg.ne.jp> writes:
|However, I think that module inclusion is not such a patching tool;
|open class is.
|Then, I guess that what we really need is a method wrapping feature:
|
| class Person
| refine_method(:speak) do |old_method, words|
| # old_method is a Method of original definition
| old_method.call("#{ words }!")
| end
| end
| Person.new.speak("matz") #=> "matz!"
Can you elaborate why you think module inclusion is not such a
patching tool, and the above "refine_method" is sought solution than
Module#prepend?
matz.