From: Phrogz Date: 2007-02-28T15:15:05+09:00 Subject: Re: Class method declarations help On Feb 27, 5:22 pm, MenTaLguY wrote: > On Wed, 28 Feb 2007 09:20:11 +0900, "jmb-d" wrote: > > OK, Chris -- I'll bite: why the preference for 1 or 2 class methods > > using "def self.my_method_name" over having many using the "class << > > self..."? > > This has come to be my own preference as well, due to the POLT (Principle of Least Typing) :) Although I see your smiley, let's analyze this. irb(main):001:0> "class << self".length => 13 irb(main):002:0> "end".length => 3 irb(main):003:0> "self.".length => 5 irb(main):004:0> 16 / 5 => 3 You'd need to type four or more 'class' methods before you made up for the overhead of typing that the singleton class technique requires. Though I suppose you could go crazy terse and use "class<