next()
public
Returns the Integer equal to int + 1,
same as Fixnum#next.
1.next
(-1).next
Show source
VALUE
rb_int_succ(VALUE num)
{
if (FIXNUM_P(num)) {
long i = FIX2LONG(num) + 1;
return LONG2NUM(i);
}
if (RB_TYPE_P(num, T_BIGNUM)) {
return rb_big_plus(num, INT2FIX(1));
}
return rb_funcall(num, '+', 1, INT2FIX(1));
}