Skip to content

Instantly share code, notes, and snippets.

@kyletolle
Created October 24, 2013 20:38
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 kyletolle/7144575 to your computer and use it in GitHub Desktop.
Save kyletolle/7144575 to your computer and use it in GitHub Desktop.
hash constant example
irb(main):017:0> HASH = { a: a, b: b }
=> {:a=>#<Object:0x007f892b9a3b00>, :b=>#<Object:0x007f892b940af0>}
irb(main):018:0> HASH[:a] = Object.new
=> #<Object:0x007f892b9c3b58>
irb(main):019:0> HASH
=> {:a=>#<Object:0x007f892b9c3b58>, :b=>#<Object:0x007f892b940af0>}
irb(main):020:0> HASH[:c] = Object.new
=> #<Object:0x007f892b9d1b18>
irb(main):021:0> HASH = {}
(irb):21: warning: already initialized constant HASH
(irb):17: warning: previous definition of HASH was here
=> {}
irb(main):022:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment