[rspec-users] class << self considered harmful... really?
Shot (Piotr Szotkowski)
shot at hot.pl
Wed Nov 26 08:23:31 EST 2008
> I'd be interested, however, in hearing about the benefits of opening
> the eigenclass to define class methods (apart from ease in searching,
> which may be best handled with ctags).
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.
Smalltalk programmers do not type, they lean their heads towards
their monitors, and meditate. The more advanced programmers do
not even need monitors. -- Phlip, comp.programming
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: not available
More information about the rspec-users