Skip to content

Instantly share code, notes, and snippets.

@rdavila
Created October 16, 2015 19:03
Show Gist options
  • Save rdavila/5212596735d5b370c492 to your computer and use it in GitHub Desktop.
Save rdavila/5212596735d5b370c492 to your computer and use it in GitHub Desktop.
result = Hash.new(0)
result[:foo] += 1
p result # I get { :foo => 1 } good.
result = Hash.new([])
result[:foo] << 1
p result # I get {} instead of { :foo => [1] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment