358件ヒット
[301-358件を表示]
(0.121秒)
ライブラリ
クラス
-
ARGF
. class (22) - Binding (10)
- Coverage (6)
-
Enumerator
:: Lazy (44) - Float (20)
- IO (11)
- Integer (22)
-
Rake
:: FileCreationTask (11) -
Rake
:: FileTask (11) -
Socket
:: AncillaryData (11) - Thread (8)
-
Thread
:: ConditionVariable (22) - ThreadsWait (36)
キーワード
-
PC
_ TIMESTAMP _ RESOLUTION (11) - Rubyの起動 (11)
-
all
_ waits (18) -
at
_ exit (11) - benchmark (11)
- bigdecimal (11)
- bm (11)
- broadcast (11)
-
clock
_ gettime (11) - downto (11)
- empty? (6)
-
enum
_ for (22) - eof (11)
- eof? (11)
- finished? (6)
-
line
_ stub (6) -
local
_ variables (10) - measure (11)
- modified? (11)
-
next
_ float (10) -
next
_ wait (6) -
prev
_ float (10) -
report
_ on _ exception (8) - select (11)
- signal (11)
-
to
_ enum (22) - waitall (11)
- xmlrpc (3)
- 制御構造 (11)
検索結果
先頭5件
-
Benchmark
. # measure(label = "") { . . . } -> Benchmark :: Tms (216.0) -
与えられたブロックを実行して、経過した時間を Process.#times で計り、 Benchmark::Tms オブジェクトを生成して返します。
...して、経過した時間を Process.#times で計り、
Benchmark::Tms オブジェクトを生成して返します。
Benchmark::Tms オブジェクトには to_s が定義されているので、
基本的には以下のように使います。
//emlist[][ruby]{
require 'benchmark'
puts Ben......chmark::CAPTION
puts Benchmark.measure { "a"*1_000_000 }
#=>
#
# user system total real
# 1.166667 0.050000 1.216667 ( 0.571355)
//}... -
Thread
. report _ on _ exception -> bool (212.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...は false です。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
こ......ようにするのがより良い方法です。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しかし、この......なかったりするかもしれません。
スレッドごとに設定する方法は Thread#report_on_exception= を参照してください。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。......。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによって... -
Integer
# downto(min) {|n| . . . } -> self (206.0) -
self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。
...self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。
self < min であれば何もしません。
@param min 数値
@return self を返します。
//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}
@see Integer#upto, Numeric#ste......p, Integer#times... -
ThreadsWait
# empty? -> bool (206.0) -
同期されるスレッドが存在するならば true をかえします。
...ッドが存在するならば true をかえします。
使用例
require 'thwait'
threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads.empty? #=> true
thall.join(*threads)
p thall.threads.empty? #=> false... -
ThreadsWait
# finished? -> bool (206.0) -
すでに終了したスレッドが存在すれば true を返します。
...に終了したスレッドが存在すれば true を返します。
使用例
require 'thwait'
threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new(*threads)
p thall.finished? #=> false
sleep 3
p thall.finished? #=> true... -
ThreadsWait
# next _ wait(nonblock = nil) -> Thread (206.0) -
指定したスレッドのどれかが終了するまで待ちます。
...待ちます。
@param nonblock true を与えると、キューが空の時、例外 ThreadsWait::ErrNoFinishedThread が発生します。
@raise ErrNoWaitingThread 終了をまつスレッドが存在しない時、発生します。
@raise ErrNoFinishedThread nonblock がtrue でかつ、キ......ューが空の時、発生します。
#使用例
require 'thwait'
threads = []
2.times {|i|
threads << Thread.new { sleep i }
}
thall = ThreadsWait.new
thall.join_nowait(*threads)
until thall.empty?
th = thall.next_wait
p th
end
@see Queue#pop... -
Rubyの起動 (114.0)
-
Rubyの起動 * cmd_option * shebang
...います。
ruby [ option ...] [ -- ] [ programfile ] [ argument ...]
ここで、option は後述のcmd_option
のいずれかを指定します。-- は、オプション列の終りを明示するため
に使用できます。programfile は、Ruby スクリプトを記述したファイ......。
//emlist{
# 変更しない場合
$ ruby -e 'p Encoding.default_external; p Encoding.default_internal'
#<Encoding:UTF-8>
nil
# 外部エンコーディングをEUC-JPにする場合
$ ruby -E EUC-JP -e 'p Encoding.default_external; p Encoding.default_internal'
#<Encoding:EUC-JP>
nil
$ ruby......各スクリプトの間に改行を
挟んで解釈します。
//emlist{
以下は等価です。
ruby -e "5.times do |i|" -e "puts i" -e "end"
ruby -e "5.times do |i|
puts i
end"
ruby -e "5.times do |i|; puts i; end"
//}
: -Fregexp
入力フィールドセパレ...