Skip to content

Instantly share code, notes, and snippets.

@JRJurman
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save JRJurman/9809401 to your computer and use it in GitHub Desktop.

Select an option

Save JRJurman/9809401 to your computer and use it in GitHub Desktop.
Odd ruby behavior with Hashes
b = Hash.new( "FOO" ) #=> {}
b[0] #=> "FOO"
b[0].chop! #=> "FO"
b #=> {}
b[0] #=> "FO"
b[1] #=> "FO"
b[0] = "BAR" #=> "BAR"
b #=> {0=>"BAR"}
b[0].chop! #=> "BA"
b[1] #=> "FO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment