Skip to content

Instantly share code, notes, and snippets.

@sugamasao
Created April 6, 2018 02:02
Show Gist options
  • Save sugamasao/c2f849587075b183ebfedc09264c0c45 to your computer and use it in GitHub Desktop.
Save sugamasao/c2f849587075b183ebfedc09264c0c45 to your computer and use it in GitHub Desktop.
hash.default
irb(main):001:0> foo = {}
=> {}
irb(main):002:0> foo.default = "a"
=> "a"
irb(main):003:0> foo[:z]
=> "a"
irb(main):004:0> foo[:z].upcase!
=> "A"
irb(main):005:0> foo[:x]
=> "A"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment