るりまサーチ

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

別のキーワード

  1. _builtin hash
  2. hash []
  3. matrix hash
  4. dbm to_hash
  5. _builtin to_hash

ライブラリ

クラス

モジュール

検索結果

<< < 1 2 3 > >>

PStore#fetch(name, default = PStore::Error) -> object (18132.0)

ルートnameに対応する値を得ます。

...]
ary = db["root"] = [1,2,3,4]
ary[0] = [1,1.5]
end

db.transaction(true) do |pstore|
pstore.fetch("root") # => [[1, 1.5], 2, 3, 4]
pstore.fetch("root", 'aaa') # => [[1, 1.5], 2, 3, 4]
pstore.fetch("not_root") # => 例外発生
end

@see Hash#fetch, PStore#[]...

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

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

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

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

begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-lengt...
...:HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # =>...

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

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

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

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

begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-lengt...
...:HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}

//emlist[例 key とブロックを指定][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # =>...

Gem::RemoteFetcher#fetch_path(uri, mtime = nil, head = false) -> String | Hash (9203.0)

与えられた URI からダウンロードしたデータを文字列として返します。

与えられた URI からダウンロードしたデータを文字列として返します。

ヘッダ情報のみ取得した場合はハッシュを返します。

@param uri データ取得先の URI を指定します。

@param mtime 更新時刻を指定します。

@param head 真を指定するとヘッダ情報のみ取得します。

Gem::SpecFetcher#latest_specs -> Hash (3102.0)

キャッシュされている最新の gemspec を返します。

キャッシュされている最新の gemspec を返します。

絞り込み条件を変える

Gem::SpecFetcher#specs -> Hash (3102.0)

キャッシュされている全ての gemspec を返します。

キャッシュされている全ての gemspec を返します。

KeyError#key -> object (13.0)

KeyError の原因となったメソッド呼び出しのキーを返します。

...ド呼び出しのキーを返します。

@raise ArgumentError キーが設定されていない時に発生します。

例:

h = Hash.new
begin
h.fetch('gumby'*20)
rescue KeyError => e
p e.message # => "key not found: \"gumbygumbygumbygumbygumbygumbygumbygumbygumbygumby...

KeyError#receiver -> object (13.0)

KeyError の原因となったメソッド呼び出しのレシーバを返します。

...しのレシーバを返します。

@raise ArgumentError レシーバが設定されていない時に発生します。

例:

h = Hash.new
begin
h.fetch('gumby'*20)
rescue KeyError => e
p e.message # => "key not found: \"gumbygumbygumbygumbygumbygumbygumbygumbygumbygumb...

TSort#each_strongly_connected_component -> Enumerator (13.0)

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

...ly_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_strongl...

TSort#each_strongly_connected_component {|nodes| ...} -> nil (13.0)

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

...ly_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_strongl...

絞り込み条件を変える

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

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

...定します。

//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_strongl...
<< < 1 2 3 > >>