instance method
Hash#>
[A, B] (::Hash[A, B]) -> bool
self > other_hash → true or false
hash.c
View on GitHub ↗
static VALUE
rb_hash_gt(VALUE hash, VALUE other)
{
other = to_hash(other);
if (RHASH_SIZE(hash) <= RHASH_SIZE(other)) return Qfalse;
return hash_le(other, hash);
}
Returns true if the entries of self are a proper superset of the entries of other_hash, false otherwise:
Example
h = {foo: 0, bar: 1, baz: 2} h > {foo: 0, bar: 1} # => true # Proper superset. h > {bar: 1, foo: 0} # => true # Order may differ. h > h # => false # Not a proper superset. h > {baz: 2, bar: 1, foo: 0} # => false # Not a proper superset. h > {foo: 0, bar: 1} # => false # Different key. h > {foo: 0, bar: 1} # => false # Different value.
See Hash Inclusion.
Raises TypeError if other_hash is not a hash and cannot be converted to a hash.
Related: see Methods for Comparing.