Ruby's Hash#default= by jgn on Thursday, July 21, 2011 in Ruby and Code

If Ruby's Hash#default= returned the Hash instead of the default object, you could write:

TRANSLATION = { 'hello' => 'bonjour' }.default=('unknown')
comments powered by Disqus