Created
August 30, 2011 08:05
-
-
Save hrstt/1180431 to your computer and use it in GitHub Desktop.
Ruby: Hash初期化でブロックを利用.各要素に空配列を用意する
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
hash = Hash.new{|h,k| h[k] = []} | |
hash[:test] << "Hello" #=> {:test => ["Hello"]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment