279件ヒット
[1-100件を表示]
(0.021秒)
ライブラリ
- ビルトイン (206)
- 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 (11)
- Numeric (55)
- Pathname (11)
- Rational (55)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - StringIO (11)
検索結果
先頭5件
-
Integer
# truncate(ndigits = 0) -> Integer (18132.0) -
0 から self までの整数で、自身にもっとも近い整数を返します。
...します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}
@see Numeric#truncate... -
Integer
# truncate(ndigits = 0) -> Integer | Float (18132.0) -
0 から self までの整数で、自身にもっとも近い整数を返します。
...定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1.0
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}
@see Numeric#truncate... -
Numeric
# truncate -> Integer (18126.0) -
0 から 自身までの整数で、自身にもっとも近い整数を返します。
...0 から 自身までの整数で、自身にもっとも近い整数を返します。
//emlist[例][ruby]{
1.truncate #=> 1
1.2.truncate #=> 1
(-1.2).truncate #=> -1
(-1.5).truncate #=> -1
//}
@see Numeric#ceil, Numeric#floor, Numeric#round... -
CSV
# truncate(path , length) -> 0 (18124.0) -
File#truncate に委譲します。
...File#truncate に委譲します。
@see File#truncate... -
Pathname
# truncate(length) -> 0 (18124.0) -
File.truncate(self.to_s, length) と同じです。
...File.truncate(self.to_s, length) と同じです。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
BigDecimal
# truncate -> Integer (18115.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
//}... -
BigDecimal
# truncate(n) -> BigDecimal (18115.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
//}... -
StringIO
# truncate(len) -> Integer (18114.0) -
自身のサイズが len になるように、自身を切り詰め、もしくは拡大します。 拡大した場合は、その部分を 0 で埋めます。 len を返します。
...でない時に発生します。
@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"
//}... -
File
# truncate(length) -> 0 (18108.0) -
ファイルのサイズを最大 length バイトにします。
...書き込み用にオープンされていなければ発生します。
@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 (18108.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate... -
Shell
:: CommandProcessor # truncate(path , length) -> 0 (18108.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate...