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

Matt Wynne matt at mattwynne.net
Tue Nov 25 13:04:23 EST 2008

On 25 Nov 2008, at 17:54, Mark Wilden wrote:

> On Tue, Nov 25, 2008 at 8:54 AM, Matt Wynne <matt at mattwynne.net>  
> wrote:
> Surely, as soon as they scroll off the screen, it's time to factor  
> that code off into a module or class of its own though?
> That's assuming there are a lot of class methods. There might be  
> only one, but if that 'class << self' is off the screen, there's the  
> potential for confusion (among noobs and gurus alike). In many if  
> not most cases I've seen, there were no counterbalancing benefits.

I don't understand. If it's off the screen, it's off the screen,  
whether it's defined using self.foo or class << self; def foo; end;

What have I missed?

> For more, see The Ruby Programming Language for their take.

I didn't know about that book! Cheers for the recommendation :)

> ///ark
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list