If Ruby’s Hash#default= returned the Hash instead of the default object, you could write:
TRANSLATION = { 'hello' => 'bonjour' }.default=('unknown')
If Ruby’s Hash#default= returned the Hash instead of the default object, you could write:
TRANSLATION = { 'hello' => 'bonjour' }.default=('unknown')
Previous post: Use of the word “bind” in JavaScript libraries
Next post: Spying on Ruby’s Net::HTTP