How to fake the ‘new’ operator in Ruby
Jan 05, 2011My friend Alejandro Crosa recently tweeted his wish that Ruby 1.9 include a ‘new’ operator like in Javascript and many other programming languages:
@nerdyc @ikai I kinda like it too, if 1.9 makes “new Class” work then all my typical javascript errors will disappear
So I decided to show him how to reproduce the new operator using Ruby meta-programming! For non-nerds, or people new to Ruby who might actually use this in real world code — THIS IS A JOKE.