==(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
h2 == h3
h3 == h4
Show source
/*
* call-seq:
* hsh == other_hash => true or false
*
* 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
* <code>Object#==</code>) 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
* h2 == h3
* h3 == h4
*
*/
static VALUE
rb_hash_equal(hash1, hash2)
VALUE hash1, hash2;
{
return hash_equal(hash1, hash2, Qfalse);
}