On 26 Nov 2008, at 14:38, Peter Jaros wrote:

On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <[EMAIL PROTECTED]> 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
definitions.

Peter

That's one of the things that attracted me to using class << self to contain all these methods - it just seemed easier to me to visualise what was going on.

I'd be really interested to know the nature of the criticisms made about it in the Matz book Mark mentioned.

cheers
Matt
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to