るりまサーチ

最速Rubyリファレンスマニュアル検索!
91件ヒット [1-91件を表示] (0.098秒)

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

クラス

モジュール

検索結果

Fiber.current -> Fiber (24220.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 (24208.0)

現在実行中のスレッド(カレントスレッド)を返します。

...現在実行中のスレッド(カレントスレッド)を返します。

p Thread.current #=> #<Thread:0x4022e6fc run>...

MiniTest::Spec.current -> MiniTest::Spec (24202.0)

現在実行中の MiniTest::Spec のインスタンスを返します。

...現在実行中の MiniTest::Spec のインスタンスを返します。...

IRB.CurrentContext -> IRB::Context (12201.0)

現在の irb に関する IRB::Context を返します。

...現在の irb に関する IRB::Context を返します。...

IRB::ExtendCommandBundle.install_extend_commands -> object (9107.0)

定義済みの拡張を読み込みます。

...。(それぞれ 1 つだけ抜粋)

* irb_current_working_workspace
* irb_change_workspace
* irb_workspaces
* irb_push_workspace
* irb_pop_workspace
* irb_load
* irb_require
* irb_source
* irb
* irb_jobs
* irb_fg
* irb_kill
* irb_help

irb/extend-command が require された時にラ...
...イブラリ内部で自動的
に実行されます。

@see IRB::ExtendCommandBundle.install_extend_commands...

絞り込み条件を変える

Thread.report_on_exception -> bool (6107.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...、その内容を $stderr に報告します。

デフォルトは false です。

T
hread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
T
raceback (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 でレポートを無効化しても
安全です。...
...、その内容を $stderr に報告します。

デフォルトは true です。

T
hread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
T
raceback (most recent call last):
2: from...

Thread.report_on_exception=(newstate) (6107.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...、その内容を $stderr に報告します。

デフォルトは false です。

T
hread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
T
raceback (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 でレポートを無効化しても
安全です。...
...、その内容を $stderr に報告します。

デフォルトは true です。

T
hread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
T
raceback (most recent call last):
2: from...

ThreadsWait.all_waits(*threads) -> () (6107.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...m threads 終了するまでまつスレッドを一つもしくは複数指定します。

require 'thwait'

t
hreads = []
5.times {|i|
t
hreads << Thread.new { sleep 1; p Thread.current }
}
T
hreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.inspect) }

# 出力例
#=> #<T...
...hread:0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread:0x2169c run>
#=> #<Thread:0x21728 run>
#=> #<Thread:0x214f8 run>
#=> end #<Thread:0x21584 dead>
#=> end #<Thread:0x21610 dead>
#=> end #<Thread:0x2169c dead>
#=> end #<Thread:0x21728 dead>
#=> end #<Thread:0x214f8 dead>...

ThreadsWait.all_waits(*threads) {|thread| ...} -> () (6107.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...m threads 終了するまでまつスレッドを一つもしくは複数指定します。

require 'thwait'

t
hreads = []
5.times {|i|
t
hreads << Thread.new { sleep 1; p Thread.current }
}
T
hreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.inspect) }

# 出力例
#=> #<T...
...hread:0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread:0x2169c run>
#=> #<Thread:0x21728 run>
#=> #<Thread:0x214f8 run>
#=> end #<Thread:0x21584 dead>
#=> end #<Thread:0x21610 dead>
#=> end #<Thread:0x2169c dead>
#=> end #<Thread:0x21728 dead>
#=> end #<Thread:0x214f8 dead>...

ThreadsWait.new(*threads) -> ThreadsWait (3207.0)

指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。

...m threads 終了を待つスレッドを一つもしくは複数指定します。

使用例
require 'thwait'

t
hreads = []
5.times {|i|
t
hreads << Thread.new { sleep 1; p Thread.current }
}

t
hall = ThreadsWait.new(*threads)
t
hall.all_waits{|th|
printf("end %s\n", th.inspect)...
...
#=> #<Thread:0x214bc run>
#=> #<Thread:0x21548 run>
#=> #<Thread:0x215d4 run>
#=> #<Thread:0x21660 run>
#=> #<Thread:0x21430 run>
#=> end #<Thread:0x214bc dead>
#=> end #<Thread:0x21548 dead>
#=> end #<Thread:0x215d4 dead>
#=> end #<Thread:0x21660 dead>
#=> end #<Thread:0x214...

絞り込み条件を変える

Data.define(*args) -> Class (3013.0)

Data クラスに新しいサブクラスを作って、それを返します。

...Data クラスに新しいサブクラスを作って、それを返します。

サブクラスでは値オブジェクトのメンバに対するアクセスメソッドが定義されています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # =>...
...list[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
fred.age = 6 # => NoMethodError
//}

メンバを持たないサブクラスも定義可能です。
以下のように、パターンマッチに利用できます。

//emlist[例][ruby]{
class HTTPFetcher
Response = Data....
...body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end

def fetch(url)
fetcher = HTTPFetcher.new
case fetcher.get(url)
in HTTPFetcher::Resp...

Data.define(*args) {|subclass| block } -> Class (3013.0)

Data クラスに新しいサブクラスを作って、それを返します。

...Data クラスに新しいサブクラスを作って、それを返します。

サブクラスでは値オブジェクトのメンバに対するアクセスメソッドが定義されています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # =>...
...list[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
fred.age = 6 # => NoMethodError
//}

メンバを持たないサブクラスも定義可能です。
以下のように、パターンマッチに利用できます。

//emlist[例][ruby]{
class HTTPFetcher
Response = Data....
...body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end
end
end

def fetch(url)
fetcher = HTTPFetcher.new
case fetcher.get(url)
in HTTPFetcher::Resp...