From: "David A. Black" Date: 2008-09-30T19:37:00+09:00 Subject: Re: extend keyword in class definition Hi -- On Tue, 30 Sep 2008, Sebastian Hungerecker wrote: > ruud grosmann wrote: >> Isn't a singleton method a method that applies to the >> singleton class of one object? > > It is a method that is defined on the singleton class of an object, yes. > As a singleton class by definition only has one instance that means that a > singleton method is a method that can be called on a single object and that > object only. Although: class C end class D < C end def C.x end D.x # subclass can call superclass's singleton methods Technically, it's also true that if you extend an object with a module, you're not really writing singleton methods, since the methods in the module are available to other objects that use the module. The singleton_method_added callback won't get called, for example. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!