Created
November 15, 2012 10:06
-
-
Save asabirov/4077800 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
deep_hash = Hash.new {|hash, key| hash[key] = Hash.new(&hash.default_proc) } | |
deep_hash[:a][:b][:c] = 23 | |
p deep # => {:a => {:b => {:c => 23}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment