[rspec-users] class << self considered harmful... really?
mark at mwilden.com
Wed Nov 26 09:46:33 EST 2008
On Wed, Nov 26, 2008 at 5: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
> 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.
Right. I was talking about the difference between using "class << self" and
"def self.foo" when other things were equal. I do understand there are
situations (like the one you mention) where it's handy to be actually in the
eigenclass when defining methods.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users