るりまサーチ

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

別のキーワード

  1. _builtin fetch
  2. dbm fetch
  3. env fetch
  4. array fetch
  5. net/http fetch

クラス

モジュール

オブジェクト

検索結果

<< < 1 2 3 4 ... > >>

Net::HTTPHeader#fetch(key) -> String (18127.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) {|hash| .... } -> String (18127.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 (18127.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 } # =>...

PStore#fetch(name, default = PStore::Error) -> object (18125.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#[]...

Array#fetch(nth) -> object (18121.0)

nth 番目の要素を返します。

...しなかった場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5]
begin
p a.fetch(10)
rescue IndexError => err
puts err #=> index 10 out of array
end

p a.fetch(10, 999) #=> 999

result = a.fetch(10){|nth|
print "#{nth} はありません。\n"
999
}
p result #=> 999
//}...

絞り込み条件を変える

Array#fetch(nth) {|nth| ... } -> object (18121.0)

nth 番目の要素を返します。

...しなかった場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5]
begin
p a.fetch(10)
rescue IndexError => err
puts err #=> index 10 out of array
end

p a.fetch(10, 999) #=> 999

result = a.fetch(10){|nth|
print "#{nth} はありません。\n"
999
}
p result #=> 999
//}...

Array#fetch(nth, ifnone) -> object (18121.0)

nth 番目の要素を返します。

...しなかった場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5]
begin
p a.fetch(10)
rescue IndexError => err
puts err #=> index 10 out of array
end

p a.fetch(10, 999) #=> 999

result = a.fetch(10){|nth|
print "#{nth} はありません。\n"
999
}
p result #=> 999
//}...

Rinda::TupleEntry#fetch(key) -> object (18107.0)

タプルの key に対応する要素を返します。

...タプルの key に対応する要素を返します。

Rinda::TupleEntry#value.fetch(key) を返します。

@param key 要素を指定するキー

@see Rinda::TupleEntry#[]...

ENV.fetch(key) -> String (18103.0)

key に関連づけられた値を返します。該当するキーが登録されてい ない時には、引数 default が与えられていればその値を、ブロッ クが与えられていればそのブロックを評価した値を返します。そのいずれ でもなければ例外が発生します。

key に関連づけられた値を返します。該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
クが与えられていればそのブロックを評価した値を返します。そのいずれ
でもなければ例外が発生します。

@param key 環境変数の名前を指定します。 文字列で指定します。
文字列以外のオブジェクトを指定した場合は
to_str メソッドによる暗黙の型変換を試みます。
@param default keyに対応する環境変数の値がないときにこの値を返します。
@raise ...

ENV.fetch(key) {|key| ... } -> String (18103.0)

key に関連づけられた値を返します。該当するキーが登録されてい ない時には、引数 default が与えられていればその値を、ブロッ クが与えられていればそのブロックを評価した値を返します。そのいずれ でもなければ例外が発生します。

key に関連づけられた値を返します。該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
クが与えられていればそのブロックを評価した値を返します。そのいずれ
でもなければ例外が発生します。

@param key 環境変数の名前を指定します。 文字列で指定します。
文字列以外のオブジェクトを指定した場合は
to_str メソッドによる暗黙の型変換を試みます。
@param default keyに対応する環境変数の値がないときにこの値を返します。
@raise ...

絞り込み条件を変える

<< < 1 2 3 4 ... > >>