340件ヒット
[1-100件を表示]
(0.108秒)
種類
- インスタンスメソッド (239)
- 特異メソッド (88)
- ライブラリ (11)
- 文書 (2)
ライブラリ
- ビルトイン (177)
- bigdecimal (55)
- csv (55)
- pathname (11)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - stringio (11)
クラス
- BigDecimal (55)
- CSV (55)
- File (33)
- Float (63)
- Integer (4)
- Numeric (22)
- Pathname (11)
- Rational (55)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - StringIO (11)
検索結果
先頭5件
-
BigDecimal
# truncate(n) -> BigDecimal (21214.0) -
小数点以下の数を切り捨てて整数にします。
...ます)。
n が負のときは小数点以上 n 桁目を操作します
(小数点位置から左に少なくとも n 個の 0 が並びます)。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").truncate(4).to_f # => 1.2345
BigDecimal("15.23456").truncate(-1).to_f # => 10.0
//}... -
File
# truncate(length) -> 0 (21207.0) -
ファイルのサイズを最大 length バイトにします。
...ファイルのサイズを最大 length バイトにします。
サイズの変更に成功すれば 0 を返します。失敗した場合は例外
Errno::EXXX が発生します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::......EXXX サイズの変更に失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "1234567890")
File.open("testfile", "a") do |f|
f.truncate(5) # => 0
f.size # => 5
end
//}... -
File
. truncate(path , length) -> 0 (21207.0) -
path で指定されたファイルのサイズを最大 length バイト にします。
...れたファイルのサイズを最大 length バイト
にします。
サイズの変更に成功すれば 0 を返します。失敗した場合は例外
Errno::EXXX が発生します。
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数......で与えます。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "1234567890")
File.truncate("testfile", 5) # => 0
File.size("testfile") # => 5
//}... -
Shell
# truncate(path , length) -> 0 (21207.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
Shell
:: CommandProcessor # truncate(path , length) -> 0 (21207.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
Shell
:: Filter # truncate(path , length) -> 0 (21207.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
BigDecimal
# truncate -> Integer (21114.0) -
小数点以下の数を切り捨てて整数にします。
...ます)。
n が負のときは小数点以上 n 桁目を操作します
(小数点位置から左に少なくとも n 個の 0 が並びます)。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").truncate(4).to_f # => 1.2345
BigDecimal("15.23456").truncate(-1).to_f # => 10.0
//}... -
Integer
# truncate(ndigits = 0) -> Integer | Float (18231.0) -
0 から self までの整数で、自身にもっとも近い整数を返します。
...0 から self までの整数で、自身にもっとも近い整数を返します。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n......定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1.0
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}
@see Numeric#truncate... -
Float
# truncate(ndigits = 0) -> Integer | Float (18225.0) -
小数点以下を切り捨てて値を整数に変換します。
...、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[例][ruby]{
2.8.truncate......# => 2
(-2.8).truncate # => -2
1.234567.truncate(2) # => 1.23
34567.89.truncate(-2) # => 34500
//}
@see Numeric#round, Numeric#ceil, Numeric#floor... -
Rational
# truncate(precision = 0) -> Rational | Integer (18225.0) -
小数点以下を切り捨てて値を整数に変換します。
...//emlist[例][ruby]{
Rational(2, 3).to_i # => 0
Rational(3).to_i # => 3
Rational(300.6).to_i # => 300
Rational(98, 71).to_i # => 1
Rational(-31, 2).to_i # => -15
//}
precision を指定した場合は指定した桁数で切り捨てた整数か
Rational を返します。
//emlist[例][......ruby]{
Rational('-123.456').truncate(+1) # => (-617/5)
Rational('-123.456').truncate(+1).to_f # => -123.4
Rational('-123.456').truncate(0) # => -123
Rational('-123.456').truncate(-1) # => -120
//}
@see Rational#ceil, Rational#floor... -
CSV
# truncate(path , length) -> 0 (18223.0) -
File#truncate に委譲します。
...File#truncate に委譲します。
@see File#truncate... -
Pathname
# truncate(length) -> 0 (18223.0) -
File.truncate(self.to_s, length) と同じです。
...File.truncate(self.to_s, length) と同じです。
@param length 変更したいサイズを整数で与えます。
@see File.truncate...