Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Hash#empty?
() -> bool
hash.empty? → true or false
hash.c
View on GitHub ↗
VALUE
rb_hash_empty_p(VALUE hash)
{
return RBOOL(RHASH_EMPTY_P(hash));
}
Returns true if there are no hash entries, false otherwise:
Example
{}.empty? # => true
{foo: 0, bar: 1, baz: 2}.empty? # => false