This code:
module Mymodule
def Mymodule.append_features(klass)
super(klass)
klass.module_eval do
def self.method_added(meth)
puts "method #{name}.#{meth.to_s} added"
end
end
end
end
class Myclass
include Mymodule
attr_accessor :hello
end
outputs this in 1.8:
method Myclass.hello added
method Myclass.hello added
method Myclass.hello= added
method Myclass.hello= added
but outputs this in 1.6.8:
method Myclass.hello added
method Myclass.hello= added
Looking in eval.c, both rb_attr and rb_add_method call klass#method_added.