End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
NilClass#to_h
nil.to_h → {}
object.c
View on GitHub ↗
static VALUE
nil_to_h(VALUE obj)
{
return rb_hash_new();
}
Always returns an empty hash.
Example
nil.to_h #=> {}