From: "David A. Black" Date: 2007-11-09T20:22:49+09:00 Subject: Re: 'Class.inherited' v. 'inherited' syntax inside Class Hi -- On Fri, 9 Nov 2007, 7stud -- wrote: > Thanks for the responses. > >> David A. Black wrote: >> Hi -- >> >> On Fri, 9 Nov 2007, 7stud -- wrote: >> >>> >>> Yet, in pickaxe2 on p. 445, the book lists inherited as a class method >>> of Class. >> >> The term "class method" can refer to either of two things: an instance >> method of Class, or a singleton method of a given class. >> > > Wouldn't it be more proper to call an instance method of Class a "Class > method" rather than a 'class method'. No, I don't think that distinction is useful. You can certainly make the distinction between instance methods of Class and singleton methods of Class objects, but in practice, they're both frequently referred to as "class methods". > In any case, I don't think your > explanation applies to the page I referenced in pickaxe2. Every class > in the reference section starts with the class name a the beginning of a > section, and then the methods for the class are listed on the subsequent > pages. But the methods are divided into the categories: Class methods, > Instance methods, and Private methods. On p. 445, it says: > > class Class < Module > ... > .. > > > Class methods: > inherited > ... > > new > ... > > Instance methods: > allocate > ... > > new > .. > > superclass > ... > > > Based on your explanation, I think that is a clear case for the errata. I think the terminology gets a bit circular at the top of the tree. inherited is (at least in 1.8.6) defined as a private instance method of Class. My experience is that instance methods of Class or Module are often referred to as "class methods". For example, it's common to refer to attr_accessor as a class method. I don't know whether that was Dave's thinking in listing it as a class method. It's also a slightly edge case since it doesn't really do anything unless you override it. David -- Upcoming training by David A. Black/Ruby Power and Light, LLC: * Advancing With Rails, Edison, NJ, November 6-9 * Advancing With Rails, Berlin, Germany, November 19-22 * Intro to Rails, London, UK, December 3-6 (by Skills Matter) See http://www.rubypal.com for details!