End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Hash#<
hash < other_hash → true or false
hash.c
View on GitHub ↗
static VALUE
rb_hash_lt(VALUE hash, VALUE other)
{
other = to_hash(other);
if (RHASH_SIZE(hash) >= RHASH_SIZE(other)) return Qfalse;
return hash_le(hash, other);
}
Returns true if hash is a proper subset of other_hash, false otherwise:
Example
h1 = {foo: 0, bar: 1} h2 = {foo: 0, bar: 1, baz: 2} h1 < h2 # => true h2 < h1 # => false h1 < h1 # => false