Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
h1 = {}
h1.default= []
h1[:a] = h1[:a] << "hi"
h1[:b] = h1[:b] << "ho"
p h1 #=> {:a=>["hi", "ho"], :b=>["hi", "ho"]}
h2 = {}
h2.default_proc = ->(hash, key){ [] }
h2[:a] = h2[:a] << "hi"
h2[:b] = h2[:b] << "ho"
p h2 #=> {:a=>["hi"], :b=>["ho"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.