From: Robert Klemme Date: 2010-11-30T17:38:23+09:00 Subject: Re: Any way to know a Class's name in class method? On Tue, Nov 30, 2010 at 6:59 AM, Kirk Haines wrote: > On Mon, Nov 29, 2010 at 10:49 PM, Eric C. wrote: >> I'm writing a class where I need to know the class's name inside a class >> method: >> >> class MyClass >>  def self.class_method >>    self.class.name # => Undefined >>    how can I get class.name here? >>  end >> end > > class MyClass >  def self.class_method >    self.name >  end > end Or even just class MyClass def self.class_method name end end Hereby I grant you the first official "useless self" award of Rubyland. ;-) Cheers robert PS: More awards at http://partmaps.org/era/unix/award.html -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/