From: Ferenc Engard Date: 2003-09-14T21:43:32+09:00 Subject: Re: problem with Module#append_features Mauricio Fern�ndez wrote: > Use Module#method_added. I have tried to do this, but unfortunately I have a bad experience. This testprogram works: -------------------------------- #!/usr/bin/env ruby class Module def append_features(klass) puts "append_features: #{klass}" if klass.method_defined?(:initialize2) # The method is already defined puts "method exists" else # The method is not yet defined puts "method does not exist" end end end module M end class A def initialize2 end include M end -------------------------------- Output: append_features: A method exists But, if I change everywhere (i.e., two places) "initialize2" to "initialize", then it will output append_features: A method does not exist The problem is, that if I want before() to work both before and after the method definition, then I have to decide whether it is defined already in append_features(). And it looks that ruby handles the 'initialize' method specially in this case. :-( Can I consider it as a bug? Ferenc