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.
Please login to continue.