method

floor

v1_8_7_330 - Show latest stable - Class: Rational
floor()
public

Converts the rational to an Integer. Not the nearest integer, the truncated integer. Study the following example carefully:

Rational(+7,4).to_i             # -> 1
Rational(-7,4).to_i             # -> -1
(-1.75).to_i                    # -> -1

In other words:

Rational(-7,4) == -1.75                 # -> true
Rational(-7,4).to_i == (-1.75).to_i     # -> true