End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Numeric#div
num.div(numeric) → integer
numeric.c
View on GitHub ↗
static VALUE
num_div(VALUE x, VALUE y)
{
if (rb_equal(INT2FIX(0), y)) rb_num_zerodiv();
return rb_funcall(num_funcall1(x, '/', y), rb_intern("floor"), 0);
}
Uses / to perform division, then converts the result to an integer. Numeric does not define the / operator; this is left to subclasses.
Equivalent to num.divmod(numeric)[0].
See Numeric#divmod.