Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Hash#<

hash < other_hash → true or false

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
See also #<= .try_convert .ruby2_keywords_hash? #== also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0