Ruby 2.2.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Numericクラス > to_int

instance method Numeric#to_int

to_int -> Integer[permalink][rdoc]

self.to_i と同じです。



(2+0i).to_int        # => 2
Rational(3).to_int   # => 3