Ruby syntax abuse
In the Ruby world some habits are becoming very common. Something I see fairly often is the (ab)use of the class << xxx
syntax, which is used to open the singleton class.
Something like this
Could be written this way:
Isn’t it simpler and more clear? I agree with the nice Metaprogramming Ruby screencasts by Dave Thomas; we should use the <<
syntax only when it simplifies the code, like in this example (taken straight from the second screencast):
Similar considerations can be found on this useful post:
http://yehudakatz.com/2009/11/12/better-ruby-idioms/