Skip to content

Instantly share code, notes, and snippets.

@marshall-lee
Last active October 29, 2015 07:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshall-lee/812ef8dc21165a58e387 to your computer and use it in GitHub Desktop.
Save marshall-lee/812ef8dc21165a58e387 to your computer and use it in GitHub Desktop.
h = { [] => :ok }
p h[[]] # ok
h = { [:lol] => :ok }
p h[[:lol]] # ok
h = { [] => :ok }
h.first.first << :lol
p h[[:lol]] # nil
p h[[]] # nil
h.first.first.clear
p h[[]] # ok
@tenderlove
Copy link

h = { [] => :ok }
p h[[]] # ok

h = { [:lol] => :ok }
p h[[:lol]] # ok

h = { [] => :ok }
h.first.first << :lol

h.rehash # hash key was mutated, so rehash

p h[[:lol]] # ok
p h[[]] # nil

h.first.first.clear
h.rehash #hash key was mutated, so rehash

p h[[]] # ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment