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

Peter Jaros peter.a.jaros at gmail.com
Wed Nov 26 09:38:58 EST 2008

On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <shot at hot.pl> wrote:

> If you don't use class << self, you have to work on class variables and
> you can't use the attr_* shorthands to access the singleton's variables.

Actually, instance variables in a "def self.*" method still refer to
the singleton object.  The body of that method is treated just like a
method in "class << self".  You just don't get a chance, as you say,
to make accessors with "attr_*", since that goes outside your method


More information about the rspec-users mailing list