From: ts Date: 2006-10-22T00:38:13+09:00 Subject: Re: instance_eval && class_eval >>>>> "X" == Xavier Noria writes: X> Is the existence of that "current" class vs self documented somewhere X> or do you know it from the sources? Does it have a name in jargon? ruby_class : it's in the source, this mean that it's documented :-) X> What about the fact that instance_eval switches current to the X> singleton class of self? I saw it works for objects which are not X> classes as well (which is a redundant exercise to reinforce this): Well a class can be seen as an object or as a class, i.e. with a class you can define a singleton method or a method. #instance_eval work with any object, and in this case a class is just an object like any other and def will define a singleton method #class_eval work only with classes (and modules) and in this case def will define instance methods. Guy Decoux