[rspec-users] class << self considered harmful... really?
Matt Wynne
matt at mattwynne.net
Tue Nov 25 08:41:23 EST 2008
Sorry, I know this is off-topic, but I'd really like to know what the
revered ruby-hackers who read this list think.
See
http://ozmm.org/posts/class__self_is_harmful.html
I have adopted class << self, partly from reading RSpec and Cucumber's
code as I learn Ruby. I personally think of class methods (or 'static'
methods) as being in a kind of 'holding pen' waiting to be factored
off onto a proper class of their own, so I rather like the clear way
you can group them in a 'nameless' metaclass ready for the exit door.
I also really like the clarity of seeing the invisible metaclass for
what it is.
What do people think? How can this be harmful?
cheers,
Matt
More information about the rspec-users
mailing list