るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

モジュール

検索結果

Net::HTTPHeader#fetch(key) -> String (18312.0)

key ヘッダフィールドを返します。

...します。

たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
...
...ise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。

//emlist[例 key のみ指定。key が存在する][ruby]{
require
'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri...
....fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require
'net/http'

begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][ruby]{
require
'net/http'

uri...

Net::HTTPHeader#fetch(key) {|hash| .... } -> String (18312.0)

key ヘッダフィールドを返します。

...します。

たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
...
...ise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。

//emlist[例 key のみ指定。key が存在する][ruby]{
require
'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri...
....fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require
'net/http'

begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][ruby]{
require
'net/http'

uri...

Net::HTTPHeader#fetch(key, default) -> String (18312.0)

key ヘッダフィールドを返します。

...します。

たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
...
...ise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。

//emlist[例 key のみ指定。key が存在する][ruby]{
require
'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri...
....fetch("user-agent") # => "Ruby"
//}

//emlist[例 key のみ指定。key が存在しない][ruby]{
require
'net/http'

begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}

//emlist[例 key , default を指定][ruby]{
require
'net/http'

uri...

TSort#each_strongly_connected_component {|nodes| ...} -> nil (125.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
i
nclude 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=>...

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

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

...せん。

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

//emlist[例 到達可能なノードを表示する][ruby]{
require
'tsort'

class Hash
i
nclude 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],...
...ngly_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 ->...

絞り込み条件を変える

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

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

...せん。

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

//emlist[例 到達可能なノードを表示する][ruby]{
require
'tsort'

class Hash
i
nclude 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],...
...ngly_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 ->...

TSort#tsort_each {|node| ...} -> nil (125.0)

TSort#tsort メソッドのイテレータ版です。 obj.tsort_each は obj.tsort.each と似ていますが、 ブロックの評価中に obj が変更された場合は予期しない結果になる ことがあります。

...は nil を返します。
閉路が存在するとき、例外 TSort::Cyclic を起こします。

@raise TSort::Cyclic 閉路が存在するとき、発生します.

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

class Hash
i
nclude TSort
alias tsort_each_node each_key
def tsort_each_child(no...
...de, &block)
fetch
(node).each(&block)
end
end

non_sort = {1=>[2, 3], 2=>[3], 3=>[], 4=>[]}

non_sort.tsort_each {|node|
non_sort.tsort_each_child(node){|child|
printf("%d -> %d\n", node, child)
}
}

# 出力
#=> 2 -> 3
#=> 1 -> 2
#=> 1 -> 3
//}

@see TSort.tsort_each...