Created
October 24, 2013 20:38
-
-
Save kyletolle/7144575 to your computer and use it in GitHub Desktop.
hash constant example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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