Skip to content

Instantly share code, notes, and snippets.

@hc5duke
Created December 15, 2012 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hc5duke/4290172 to your computer and use it in GitHub Desktop.
Save hc5duke/4290172 to your computer and use it in GitHub Desktop.
hash defaults don't work like that.
> a = {}
# => {}
> a.default = []
# => []
> a[:b]
# => []
> a[:b] << 3
# => [3]
> a
# => {}
> a[:b]
# => [3]
> a[:c]
# => [3]
> a[:d]
# => [3]
# and so on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment