るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.106秒)

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

検索結果

Integer#truncate(ndigits = 0) -> Integer (54445.0)

0 から self までの整数で、自身にもっとも近い整数を返します。

0 から self までの整数で、自身にもっとも近い整数を返します。

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}

@see Numeric#truncate

Pathname#truncate(length) -> 0 (54421.0)

File.truncate(self.to_s, length) と同じです。

File.truncate(self.to_s, length) と同じです。


@param length 変更したいサイズを整数で与えます。

@see File.truncate

Numeric#remainder(other) -> Numeric (160.0)

self を other で割った余り r を返します。

self を other で割った余り r を返します。

ここで、商 q と余り r は、

* self == other * q + r


* self > 0 のとき 0 <= r < |other|
* self < 0 のとき -|other| < r <= 0
* q は整数

をみたす数です。r の符号は self と同じになります。
商 q を直接返すメソッドはありません。self.quo(other).truncate がそれに相当します。

@param other 自身を割る数を指定します。

//emlist[例][ruby]{
p 13....