Method: Hash#==

Defined in:
hash.c

#==(object) ⇒ Boolean

Returns true if all of the following are true:

  • object is a Hash object.

  • hash and object have the same keys (regardless of order).

  • For each key key, hash[key] == object[key].

Otherwise, returns false.

Equal:

h1 = {foo: 0, bar: 1, baz: 2}
h2 = {foo: 0, bar: 1, baz: 2}
h1 == h2 # => true
h3 = {baz: 2, bar: 1, foo: 0}
h1 == h3 # => true

Returns:

  • (Boolean)


3822
3823
3824
3825
3826
# File 'hash.c', line 3822

static VALUE
rb_hash_equal(VALUE hash1, VALUE hash2)
{
    return hash_equal(hash1, hash2, FALSE);
}