ライブラリ
- ビルトイン (55)
-
net
/ http (22) - tsort (74)
-
win32
/ registry (11)
クラス
- Hash (55)
-
Win32
:: Registry (11)
モジュール
-
Net
:: HTTPHeader (22) - TSort (74)
キーワード
- each (11)
-
each
_ name (11) -
each
_ pair (11) -
each
_ strongly _ connected _ component (21) -
each
_ strongly _ connected _ component _ from (21) -
each
_ value (11) - invert (11)
-
strongly
_ connected _ components (11) -
tsort
_ each (21)
検索結果
先頭5件
-
Net
:: HTTPHeader # each _ key {|name| . . . } -> () (21202.0) -
保持しているヘッダ名をブロックに渡して呼びだします。
...呼びだします。
ヘッダ名は小文字で統一されます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.each_name { |name| puts name }
# => accept-encoding
# => accept
# => user-agent
//}... -
Win32
:: Registry # each _ key {|subkey , wtime| . . . } (21102.0) -
@todo
...@todo
キーのサブキーを列挙します。
subkey はサブキーの名前を表す String です。
wtime は最終更新時刻を表す FILETIME (64-bit 整数) です。
(⇒Win32::Registry.wtime2time)... -
Hash
# each _ key -> Enumerator (18221.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... -
Net
:: HTTPHeader # each _ name {|name| . . . } -> () (9202.0) -
保持しているヘッダ名をブロックに渡して呼びだします。
...呼びだします。
ヘッダ名は小文字で統一されます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.each_name { |name| puts name }
# => accept-encoding
# => accept
# => user-agent
//}... -
TSort
# each _ strongly _ connected _ component _ from(node , id _ map={} , stack=[]) -> Enumerator (6113.0) -
node から到達可能な強連結成分についてのイテレータです。
...
node から到達可能な強連結成分についてのイテレータです。
返す値は規定されていません。
each_strongly_connected_component_from は
tsort_each_node を呼びません。
@param node ノードを指定します。
//emlist[例 到達可能なノードを表示......include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_strongly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_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| . . . } -> () (6113.0) -
node から到達可能な強連結成分についてのイテレータです。
...
node から到達可能な強連結成分についてのイテレータです。
返す値は規定されていません。
each_strongly_connected_component_from は
tsort_each_node を呼びません。
@param node ノードを指定します。
//emlist[例 到達可能なノードを表示......include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_strongly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_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... -
Hash
# invert -> Hash (6107.0) -
値からキーへのハッシュを作成して返します。
..., "e" => 300 }
p h.invert #=> {0=>"a", 100=>"b", 200=>"c", 300=>"e"}
//}
=== 参考
値が重複していたときに備えて、変換後の値を配列として保持するには、次のようにします。
//emlist[][ruby]{
def safe_invert(orig_hash)
orig_hash.each_key.group_by do |key|......orig_hash[key]
end
end
p safe_invert({"a"=>1, "b"=>1, "c"=>3}) # => {1=>["a", "b"], 3=>["c"]}
//}
@see Hash#key... -
TSort
# each _ strongly _ connected _ component -> Enumerator (6107.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...TSort#strongly_connected_components メソッドのイテレータ版です。
obj.each_strongly_connected_component は
obj.strongly_connected_components.each に似ていますが、
ブロックの評価中に obj が変更された場合は予期しない結果になる
ことがあります。......ngly_connected_component は nil を返します。
//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
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_stron......gly_connected_component{|nodes|
p nodes
}
#出力
#=> [4]
#=> [2, 3]
#=> [1]
//}
@see TSort.each_strongly_connected_component... -
TSort
# each _ strongly _ connected _ component {|nodes| . . . } -> nil (6107.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...TSort#strongly_connected_components メソッドのイテレータ版です。
obj.each_strongly_connected_component は
obj.strongly_connected_components.each に似ていますが、
ブロックの評価中に obj が変更された場合は予期しない結果になる
ことがあります。......ngly_connected_component は nil を返します。
//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
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
non_sort.each_stron......gly_connected_component{|nodes|
p nodes
}
#出力
#=> [4]
#=> [2, 3]
#=> [1]
//}
@see TSort.each_strongly_connected_component... -
TSort
# strongly _ connected _ components -> Array (6107.0) -
強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。
...rt'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
p non_sort.strongly_connected_components
#=> [[4], [2, 3], [1]]
//}
@see TSort.strongly_connected_components...