239件ヒット
[1-100件を表示]
(0.147秒)
ライブラリ
- ビルトイン (166)
- bigdecimal (22)
- csv (11)
- pathname (11)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - stringio (11)
クラス
- BigDecimal (22)
- CSV (11)
- File (22)
- 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 (21215.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 (21208.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
//}... -
Shell
# truncate(path , length) -> 0 (21208.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
Shell
:: CommandProcessor # truncate(path , length) -> 0 (21208.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
Shell
:: Filter # truncate(path , length) -> 0 (21208.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
BigDecimal
# truncate -> Integer (21115.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 (18232.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 (18226.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 (18226.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 (18224.0) -
File#truncate に委譲します。
...File#truncate に委譲します。
@see File#truncate... -
Pathname
# truncate(length) -> 0 (18224.0) -
File.truncate(self.to_s, length) と同じです。
...File.truncate(self.to_s, length) と同じです。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
StringIO
# truncate(len) -> Integer (18214.0) -
自身のサイズが len になるように、自身を切り詰め、もしくは拡大します。 拡大した場合は、その部分を 0 で埋めます。 len を返します。
...自身のサイズが len になるように、自身を切り詰め、もしくは拡大します。
拡大した場合は、その部分を 0 で埋めます。
len を返します。
@param len 変更したいサイズを整数で指定します。
@raise IOError 自身が書き込み可能で......ない時に発生します。
@raise Errno::EINVAL len がマイナスの時に発生します。
//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge", 'r+')
a.truncate(2)
a.string #=> "ho"
a.truncate(5)
a.string #=> "ho\000\000\000"
//}...