Skip to content

Instantly share code, notes, and snippets.

@asabirov
Created November 15, 2012 10:06
Show Gist options
  • Save asabirov/4077800 to your computer and use it in GitHub Desktop.
Save asabirov/4077800 to your computer and use it in GitHub Desktop.
Использование любой вложенности хеша без предварительного создания вложенных
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