From: ts Date: 2006-10-21T22:40:42+09:00 Subject: Re: instance_eval && class_eval >>>>> "P" == Phrogz writes: P> I'm not surprised by that. I'm surprised that standard def...end syntax P> inside instance_eval behaves differently from being in the class scope, P> when the self object in both cases is the same. def is a keyword and it don't use self to know where the method must be defined but it use an "internal" variable the "current" class. P> irb(main):001:0> class Foo here you have self = current class = Foo P> irb(main):002:1> p "Defining aa in #{self}##{self.object_id}" P> irb(main):003:1> def aa; p :aa; end P> irb(main):004:1> instance_eval{ in instance_eval you have self = Foo current class = Foo singleton class P> irb(main):005:2* p "Defining bb in #{self}##{self.object_id}" P> irb(main):006:2> def bb; p :bb; end Guy Decoux