Created
April 6, 2018 02:21
-
-
Save igaiga/99ecfb9999cf71409f6d40b6c3bbad76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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