method
==
==(p1)
public
Equality—Two hashes are equal if they each contain the same number of keys and if each key-value pair is equal to (according to Object#==) the corresponding elements in the other hash.
h1 = { "a" => 1, "c" => 2 } h2 = { 7 => 35, "c" => 2, "a" => 1 } h3 = { "a" => 1, "c" => 2, 7 => 35 } h4 = { "a" => 1, "d" => 2, "f" => 35 } h1 == h2 #=> false h2 == h3 #=> true h3 == h4 #=> false
The orders of each hashes are not compared.
h1 = { "a" => 1, "c" => 2 } h2 = { "c" => 2, "a" => 1 } h1 == h2 #=> true