種類
- インスタンスメソッド (177)
- 特異メソッド (55)
- クラス (33)
- モジュール関数 (22)
- 定数 (11)
クラス
- File (22)
- Float (11)
- Integer (11)
- Mutex (2)
- Numeric (11)
- Rational (11)
- Thread (133)
-
Thread
:: Mutex (9) - ThreadGroup (22)
モジュール
-
File
:: Constants (11) - Kernel (22)
キーワード
- RuntimeError (11)
- TRUNC (11)
- Thread (11)
- ThreadError (11)
- add (11)
-
backtrace
_ locations (22) - current (11)
- inspect (11)
- list (22)
- main (11)
-
report
_ on _ exception (8) -
report
_ on _ exception= (8) - sleep (33)
- status (11)
- stop (11)
-
to
_ s (7) - truncate (66)
- wakeup (11)
検索結果
先頭5件
-
Thread
# run -> self (29209.0) -
停止状態(stop)のスレッドを再開させます。 Thread#wakeup と異なりすぐにスレッドの切り替え を行います。
...ead#wakeup と異なりすぐにスレッドの切り替え
を行います。
@raise ThreadError 死んでいるスレッドに対して実行すると発生します。
//emlist[例][ruby]{
a = Thread.new { puts "a"; Thread.stop; puts "c" }
sleep 0.1 while a.status!='sleep'
puts "Got here"
a.run......a.join
# => a
# => Got here
# => c
//}
@see Thread#wakeup, Thread.stop... -
File
# truncate(length) -> 0 (20202.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 (20202.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
//}... -
Integer
# truncate(ndigits = 0) -> Integer (20202.0) -
0 から self までの整数で、自身にもっとも近い整数を返します。
...self までの整数で、自身にもっとも近い整数を返します。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
//eml......ist[][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 (20202.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... -
Numeric
# truncate -> Integer (20202.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... -
RuntimeError (20002.0)
-
特定の例外クラスには該当しないエラーが起こったときに発生します。 また Kernel.#raise で例外クラスを指定しなかった場合も RuntimeError が発生します。
...特定の例外クラスには該当しないエラーが起こったときに発生します。
また Kernel.#raise で例外クラスを指定しなかった場合も
RuntimeError が発生します。... -
Thread
# report _ on _ exception -> bool (17220.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...tderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Threa......p; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x0......0007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
Thread
# report _ on _ exception=(newstate) (17220.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...tderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Threa......p; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x0......0007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run # => #<Thread:0x00007fc3f48aefc0@(irb):4 dead>
//}
@see Thread.report_on_exception... -
File
:: Constants :: TRUNC -> Integer (17202.0) -
もしファイルが存在するなら、中身を抹消してサイズをゼロにします。 File.openで使用します。
...もしファイルが存在するなら、中身を抹消してサイズをゼロにします。
File.openで使用します。... -
Float
# truncate -> Integer (14202.0) -
小数点以下を切り捨てて値を整数に変換します。
...小数点以下を切り捨てて値を整数に変換します。
//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
//}
@see Numeric#round, Numeric#ceil, Numeric#floor... -
Float
# truncate(ndigits = 0) -> Integer | Float (14202.0) -
小数点以下を切り捨てて値を整数に変換します。
...nteger を返します。
小数点位置から左に少なくとも 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#cei......l, Numeric#floor...