compare_by_identity

hsh.compare_by_identity â hsh
Instance Public methods

Makes hsh compare its keys by their identity, i.e. it will consider exact same objects as same keys.

h1 = { "a" => 100, "b" => 200, :c => "c" }
h1["a"]        #=> 100
h1.compare_by_identity
h1.compare_by_identity? #=> true
h1["a"]        #=> nil  # different objects.
h1[:c]         #=> "c"  # same symbols are all same.
doc_ruby_on_rails
2015-04-11 22:00:06
Comments
Leave a Comment

Please login to continue.