種類
- インスタンスメソッド (117)
- 特異メソッド (70)
- ライブラリ (24)
モジュール
-
Net
:: HTTPHeader (24) - TSort (163)
キーワード
-
each
_ name (12) -
each
_ strongly _ connected _ component (46) -
each
_ strongly _ connected _ component _ from (23) -
strongly
_ connected _ components (24) - tsort (36)
-
tsort
_ each (46) -
win32
/ registry (12)
検索結果
先頭5件
- Net
:: HTTPHeader # each _ key {|name| . . . } -> () - Net
:: HTTPHeader # each _ name {|name| . . . } -> () - TSort
. each _ strongly _ connected _ component(each _ node , each _ child) -> Enumerator - TSort
. each _ strongly _ connected _ component(each _ node , each _ child) {|nodes| . . . } -> nil - TSort
. strongly _ connected _ components(each _ node , each _ child) -> Array
-
Net
:: HTTPHeader # each _ key {|name| . . . } -> () (18107.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 }
# =>... -
Net
:: HTTPHeader # each _ name {|name| . . . } -> () (3007.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 }
# =>... -
TSort
. each _ strongly _ connected _ component(each _ node , each _ child) -> Enumerator (18.0) -
TSort.strongly_connected_components メソッドのイテレータ版です。
...ッ
ドを持つオブジェクトを指定します。
//emlist[使用例][ruby]{
require '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, e......ach_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]
/... -
TSort
. each _ strongly _ connected _ component(each _ node , each _ child) {|nodes| . . . } -> nil (18.0) -
TSort.strongly_connected_components メソッドのイテレータ版です。
...ッ
ドを持つオブジェクトを指定します。
//emlist[使用例][ruby]{
require '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, e......ach_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]
/... -
TSort
. strongly _ connected _ components(each _ node , each _ child) -> Array (18.0) -
強連結成分の集まりを配列の配列として返します。 この配列は子から親に向かってソートされています。 各要素は強連結成分を表す配列です。
...ッ
ドを持つオブジェクトを指定します。
//emlist[使用例][ruby]{
require '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, eac......h_child)
# => [[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) }
p TSort.strongly_connected_components(each_node, each_child)
# => [[4], [2, 3], [1]]
//}
@see TSort#strongly_connected_components... -
TSort
. tsort(each _ node , each _ child) -> Array (18.0) -
頂点をトポロジカルソートして得られる配列を返します。 この配列は子から親に向かってソートされています。 すなわち、最初の要素は子を持たず、最後の要素は親を持ちません。
...例][ruby]{
require '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.tsort(each_node, each_child) # => [4, 2, 3, 1]
g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
each_node = lambda {|&b| g.each_key(&b) }
each_... -
tsort (18.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...ルソートと強連結成分に関するモジュールを提供します。
=== Example
//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
{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.t......3], [1]]
//}
=== より現実的な例
非常に単純な `make' に似たツールは以下のように実装できます。
//emlist[][ruby]{
require 'tsort'
class Make
def initialize
@dep = {}
@dep.default = []
end
def rule(outputs, inputs=[], &block)
triple = [outputs, inp... -
win32
/ registry (18.0) -
win32/registry は Win32 プラットフォームでレジストリをアクセスするための ライブラリです。Win32 API の呼び出しに Win32API を使います。
...ームでレジストリをアクセスするための
ライブラリです。Win32 API の呼び出しに Win32API を使います。
//emlist{
require 'win32/registry'
Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\foo') do |reg|
value = reg['foo'] # 値の読......reg.write('foo', Win32::Registry::REG_SZ, 'bar') # 値の書き込み
reg.each_value { |name, type, data| ... } # 値の列挙
reg.each_key { |key, wtime| ... } # サブキーの列挙
reg.delete_value('foo') # 値の削除
reg.delete_key('......ジストリをアクセスするには WIN32OLE を使って WScript.Shell オブジェクト経由でアクセスする方法もあります。
require 'win32ole'
wsh = WIN32OLE.new('WScript.Shell')
value = wsh.RegRead 'HKLM\Software\Microsoft\Windows\...'
wsh.RegWrite 'HKCU\Software\foo... -
TSort
# each _ strongly _ connected _ component -> Enumerator (12.0) -
TSort#strongly_connected_components メソッドのイテレータ版です。 obj.each_strongly_connected_component は obj.strongly_connected_components.each に似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。
...とがあります。
each_strongly_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=>...