Last Updated: February 25, 2016
·
740
· chrismo

Ruby Hash initializer takes block to define default values

I need this burned in my brain:

result = Hash.new { |h, k| h[k] = {} }