Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
NilClass#to_r
() -> ::Rational
to_r → (0/1)
rational.c
View on GitHub ↗
static VALUE
nilclass_to_r(VALUE self)
{
return rb_rational_new1(INT2FIX(0));
}
Returns zero as a Rational:
Example
nil.to_r # => (0/1)