method

to_i

v2_4_6 - Show latest stable - Class: Rational
to_i()
public

Returns the truncated value as an integer.

Equivalent to Rational#truncate.

Rational(2, 3).to_i   #=> 0
Rational(3).to_i      #=> 3
Rational(300.6).to_i  #=> 300
Rational(98,71).to_i  #=> 1
Rational(-30,2).to_i  #=> -15