From: David Pollak Date: 2006-04-21T08:24:32+09:00 Subject: Re: how to figure out what class a method is in for a *class method*? ------=_Part_25117_21878888.1145575469547 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/20/06, Philip Hallstrom wrote: > > Hi all - > > Given the following bit of code, I'd like it to spit out "Cat" followed b= y > "Dog", but what I get now is "Object" twice. > > --------------------------------------------------------------- > class Animal > def self.what_am_i > self.class > end > end Try def self.what_am_i self.name end Because self is an instance of Class, you want to ask it what its name is. ------=_Part_25117_21878888.1145575469547--