るりまサーチ

最速Rubyリファレンスマニュアル検索!
248件ヒット [1-100件を表示] (0.160秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:n[x] > クエリ:each_key[x]

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. pop n_mails
  3. pop n_bytes
  4. pop3 n_bytes
  5. rsa n

ライブラリ

クラス

モジュール

オブジェクト

検索結果

<< 1 2 3 > >>

Net::HTTPHeader#each_key {|name| ... } -> () (24313.0)

保持しているヘッダ名をブロックに渡して呼びだします。

...呼びだします。

ヘッダ名は小文字で統一されます。

//emlist[例][ruby]{
r
equire 'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq.each_name { |name| puts name }

# => accept-encoding
# => accept
# => user-agent
//}...

Win32::Registry#each_key {|subkey, wtime| ... } (24107.0)

@todo

...@todo

キーのサブキーを列挙します。

subkey はサブキーの名前を表す String です。
wtime は最終更新時刻を表す FILETIME (64-bit 整数) です。
(⇒Win32::Registry.wtime2time)...

ENV.each_key -> Enumerator (21408.0)

key を引数としてブロックを評価します。

...key を引数としてブロックを評価します。

//emlist[][ruby]{
ENV['FOO'] = 'bar'
ENV.each_key do |key|
p "key #{key} detected" if key == 'FOO'
end
# "key FOO detected"
//}...

Hash#each_key -> Enumerator (18420.0)

ハッシュのキーを引数としてブロックを評価します。

...れた順です。
ブロック付きの場合selfを、
無しで呼ばれた場合Enumeratorを返します。

//emlist[例][ruby]{
{:a=>1, :b=>2}.each_key {|k| p k}
#=> :a
# :b

p({:a=>1, :b=>2}.each_key) # => #<Enumerator: {:a=>1, :b=>2}:each_key>
//}

@see Hash#each_pair,Hash#each_value...

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) -> Enumerator (15412.0)

node から到達可能な強連結成分についてのイテレータです。

...
n
ode から到達可能な強連結成分についてのイテレータです。

返す値は規定されていません。

each_strongly_connected_component_from は
tsort_each_node を呼びません。

@param node ノードを指定します。

//emlist[例 到達可能なノードを表示...
...][ruby]{
r
equire 'tsort'

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

n
on_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

n
on_sort.each_strongly_connected_component{|nodes|
p nodes
n
odes.each {|node|
n
on_...
...sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}

@see TSort.each_strongly_connected_component_from...

絞り込み条件を変える

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) {|nodes| ...} -> () (15412.0)

node から到達可能な強連結成分についてのイテレータです。

...
n
ode から到達可能な強連結成分についてのイテレータです。

返す値は規定されていません。

each_strongly_connected_component_from は
tsort_each_node を呼びません。

@param node ノードを指定します。

//emlist[例 到達可能なノードを表示...
...][ruby]{
r
equire 'tsort'

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

n
on_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

n
on_sort.each_strongly_connected_component{|nodes|
p nodes
n
odes.each {|node|
n
on_...
...sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}

@see TSort.each_strongly_connected_component_from...

TSort.each_strongly_connected_component(each_node, each_child) -> Enumerator (12336.0)

TSort.strongly_connected_components メソッドのイテレータ版です。

...TSort.strongly_connected_components メソッドのイテレータ版です。

引数 each_node と each_child でグラフを表します。

@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。

@param...
...クトを指定します。

//emlist[使用例][ruby]{
r
equire 'tsort'

g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

# => [4]
# [2]
#...
...[3]
# [1]

g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

# => [4]
# [2, 3]
# [1]
//}

@see TSort#each_strongly_connected_component...

TSort.each_strongly_connected_component(each_node, each_child) {|nodes| ...} -> nil (12336.0)

TSort.strongly_connected_components メソッドのイテレータ版です。

...TSort.strongly_connected_components メソッドのイテレータ版です。

引数 each_node と each_child でグラフを表します。

@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。

@param...
...クトを指定します。

//emlist[使用例][ruby]{
r
equire 'tsort'

g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

# => [4]
# [2]
#...
...[3]
# [1]

g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }

# => [4]
# [2, 3]
# [1]
//}

@see TSort#each_strongly_connected_component...

TSort.strongly_connected_components(each_node, each_child) -> Array (12336.0)

強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。

...結成分を表す配列です。

引数 each_node と each_child でグラフを表します。

@param each_node グラフ上の頂点をそれぞれ評価するcallメソッドを持つオブ
ジェクトを指定します。

@param each_child 引数で与えられた頂点の...
...例][ruby]{
r
equire 'tsort'

g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
p TSort.strongly_connected_components(each_node, each_child)
# => [[4], [2], [3], [1]]

g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lam...
...bda {|&b| g.each_key(&b) }
each_child = lambda {|n, &b| g[n].each(&b) }
p TSort.strongly_connected_components(each_node, each_child)
# => [[4], [2, 3], [1]]
//}

@see TSort#strongly_connected_components...

Net::HTTPHeader#each_name {|name| ... } -> () (12313.0)

保持しているヘッダ名をブロックに渡して呼びだします。

...呼びだします。

ヘッダ名は小文字で統一されます。

//emlist[例][ruby]{
r
equire 'net/http'

uri = URI.parse('http://www.example.com/index.html')
r
eq = Net::HTTP::Get.new(uri.request_uri)
r
eq.each_name { |name| puts name }

# => accept-encoding
# => accept
# => user-agent
//}...

絞り込み条件を変える

<< 1 2 3 > >>