method
truncate
v2_4_6 -
Show latest stable
- Class:
Integer
truncate(*args)public
Returns the smallest number than or equal to int in decimal digits (default 0 digits).
Precision may be negative. Returns a floating point number when ndigits is positive, self for zero, and truncate up for negative.
1.truncate #=> 1 1.truncate(2) #=> 1.0 15.truncate(-1) #=> 10