別のキーワード
ライブラリ
- ビルトイン (45)
- fiber (8)
- irb (11)
-
irb
/ extend-command (11) -
minitest
/ spec (1) - thwait (18)
クラス
- Data (4)
- Fiber (11)
-
MiniTest
:: Spec (1) - Thread (27)
- ThreadsWait (18)
モジュール
- IRB (11)
-
IRB
:: ExtendCommandBundle (11) - Process (11)
キーワード
- CurrentContext (11)
-
all
_ waits (12) - define (4)
- exec (11)
-
install
_ extend _ commands (11) - new (6)
-
report
_ on _ exception (8) -
report
_ on _ exception= (8)
検索結果
先頭5件
-
Fiber
. current -> Fiber (18120.0) -
このメソッドが評価されたコンテキストにおける Fiber のインスタンスを返します。
...のメソッドが評価されたコンテキストにおける Fiber のインスタンスを返します。
//emlist[例:][ruby]{
fr = Fiber.new do
Fiber.current
end
fb = fr.resume
p fb.equal?(fr) # => true
p Fiber.current # => #<Fiber:0x91345e4>
p Fiber.current # => #<Fiber:0x91345e4>
//}... -
Thread
. current -> Thread (18108.0) -
現在実行中のスレッド(カレントスレッド)を返します。
...現在実行中のスレッド(カレントスレッド)を返します。
p Thread.current #=> #<Thread:0x4022e6fc run>... -
MiniTest
:: Spec . current -> MiniTest :: Spec (18102.0) -
現在実行中の MiniTest::Spec のインスタンスを返します。
現在実行中の MiniTest::Spec のインスタンスを返します。 -
IRB
. CurrentContext -> IRB :: Context (6101.0) -
現在の irb に関する IRB::Context を返します。
現在の irb に関する IRB::Context を返します。 -
Data
. define(*args) -> Class (13.0) -
Data クラスに新しいサブクラスを作って、それを返します。
...body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end
def fetch(url)
fetcher = HTTPFetcher.new
case fetcher.get(url)
in HTTPFetcher::Response(body)
body
in HTTPFetcher::NotFound
:NotFound
end
end
p fetch("http://example.com/") # => "Current time i... -
Data
. define(*args) {|subclass| block } -> Class (13.0) -
Data クラスに新しいサブクラスを作って、それを返します。
...body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end
def fetch(url)
fetcher = HTTPFetcher.new
case fetcher.get(url)
in HTTPFetcher::Response(body)
body
in HTTPFetcher::NotFound
:NotFound
end
end
p fetch("http://example.com/") # => "Current time i... -
IRB
:: ExtendCommandBundle . install _ extend _ commands -> object (7.0) -
定義済みの拡張を読み込みます。
...の拡張を読み込みます。
irb で以下のメソッドが利用できるようになります。(それぞれ 1 つだけ抜粋)
* irb_current_working_workspace
* irb_change_workspace
* irb_workspaces
* irb_push_workspace
* irb_pop_workspace
* irb_load
* irb_require
* irb_source
*... -
Process
. exec(command , *args) -> () (7.0) -
カレントプロセスを与えられた外部コマンドで置き換えます。
...からいくつかの環境を引き継ぎます。
@param command 実行する外部コマンド。
@param args command に渡す引数。
exec "echo *" # echoes list of files in current directory
# never get here
exec "echo", "*" # echoes an asterisk
# never get here... -
Thread
. report _ on _ exception -> bool (7.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...す。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しかし、この場合、例外をハンドルするのが... -
Thread
. report _ on _ exception=(newstate) (7.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...す。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しかし、この場合、例外をハンドルするのが... -
ThreadsWait
. all _ waits(*threads) -> () (7.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...ドを一つもしくは複数指定します。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
ThreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.inspect) }
# 出力例
#=> #<Thread:0x21584 run>
#=> #<Thread:0x21610 r... -
ThreadsWait
. all _ waits(*threads) {|thread| . . . } -> () (7.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...ドを一つもしくは複数指定します。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
ThreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.inspect) }
# 出力例
#=> #<Thread:0x21584 run>
#=> #<Thread:0x21610 r... -
ThreadsWait
. new(*threads) -> ThreadsWait (7.0) -
指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。
...つもしくは複数指定します。
使用例
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
printf("end %s\n", th.inspect)
}
# 出力例
#=> #<Thread:0x214b...