CoffeeScript Constructor For Ruby 04 Jul 2012
I really like CoffeeScript’s short-hand for writing a constructor which automatically sets instance variables. I’m a total believer in removing unnecessary code and syntax when possible.

So, this morning when sitting down to investigate The Drunken Cockroach Problem I thought to myself, I don’t want to write any more boilerplate code than I have to, so here’s my CoffeeScript-style constructor function in Ruby:

blog comments powered by Disqus