るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. rsa p

ライブラリ

クラス

モジュール

検索結果

<< < ... 5 6 7 >>

TSort#tsort -> Array (13.0)

頂点をトポロジカルソートして得られる配列を返します。 この配列は子から親に向かってソートされています。 すなわち、最初の要素は子を持たず、最後の要素は親を持ちません。

...発生します。

//emlist[使用例][ruby]{
require 'tsort'

class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch
(node).each(&block)
end
end

sorted = {1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
p
sorted #=> [3, 2, 1, 4]
//}

@see TSort.tsort...

Thread#[](name) -> object | nil (13.0)

name に対応したスレッドに固有のデータを取り出します。 name に対応するスレッド固有データがなければ nil を返し ます。

...@param name スレッド固有データのキーを文字列か Symbol で指定します。

//emlist[例][ruby]{
[
Thread.new { Thread.current["name"] = "A" },
Thread.new { Thread.current[:name] = "B" },
Thread.new { Thread.current["name"] = "C" }
].each do |th|
th.join
p
uts "#{th.inspe...
...e
p
Thread.current[:name]
# => nil if fiber-local
# => 2 if thread-local (The value 2 is leaked to outside of meth method.)
//}

Fiber を切り替えても同じ変数を返したい場合は
Thread#thread_variable_get と Thread#thread_variable_set
を使用してください。

@see Thread#fetch...
<< < ... 5 6 7 >>