Skip to content

Instantly share code, notes, and snippets.

@allcentury
Created July 28, 2015 15:17
Show Gist options
  • Save allcentury/514e32857cb7e073271d to your computer and use it in GitHub Desktop.
Save allcentury/514e32857cb7e073271d to your computer and use it in GitHub Desktop.
[1] pry(main)> h = Hash.new({})
=> {}
[2] pry(main)> h[:a]
=> {}
[3] pry(main)> h["a"]
=> {}
[4] pry(main)> h
=> {}
[5] pry(main)> h = Hash.new { |k, v| k[v] = {} }
=> {}
[6] pry(main)> h[:a]
=> {}
[7] pry(main)> h
=> {:a=>{}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment