Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Integerクラス > truncate
truncate(ndigits = 0) -> Integer
[permalink][rdoc]0 から self までの整数で、自身にもっとも近い整数を返します。
1.truncate # => 1
1.truncate(2) # => 1
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
[SEE_ALSO] Numeric#truncate