Ruby Hash initializer takes block to define default values
I need this burned in my brain:
result = Hash.new { |h, k| h[k] = {} }
Written by chrismo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#