[rspec-users] class << self considered harmful... really?

Avdi Grimm avdi at avdi.org
Wed Nov 26 11:39:48 EST 2008


On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <shot at hot.pl> wrote:
> Such methods have access to the eigenclass's instance variables, and so
> class << self works very nice when working with singletons (like Log or
> Config).

I've never had trouble accessing class-level instance variables
(@variables) in class methods defined as "def self.foo".   In fact I
hardly ever use @@variables, and I never use class << self for
defining class methods.

-- 
Avdi

Home: http://avdi.org
Developer Blog: http://avdi.org/devblog/
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com


More information about the rspec-users mailing list