るりまサーチ

最速Rubyリファレンスマニュアル検索!
182件ヒット [1-100件を表示] (0.122秒)
トップページ > クエリ:i[x] > クエリ:end[x] > クエリ:fetch[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. ipaddr to_i
  5. kernel $-i

検索結果

<< 1 2 > >>

Gem::SpecFetcher#fetch(dependency, all = false, matching_platform = true) -> Array (21301.0)

依存関係を満たす gemspec の配列を返します。

...返します。

@param dependency 依存関係を指定します。
@param all 真を指定するとマッチする全てのバージョンの情報を返します。
@param matching_platform 偽を指定すると全てのプラットフォームの情報を返します。

@see Gem::Dependency...

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

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

...します。

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

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
...
...list[例 key のみ指定。key が存在する][ruby]{
require 'net/http'

uri = URI.parse('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-length">
end

//}

//emlist[例 key , default を指定][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", "defau...

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

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

...します。

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

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
...
...list[例 key のみ指定。key が存在する][ruby]{
require 'net/http'

uri = URI.parse('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-length">
end

//}

//emlist[例 key , default を指定][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", "defau...

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

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

...します。

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

該当するキーが登録されてい
ない時には、引数 default が与えられていればその値を、ブロッ
...
...list[例 key のみ指定。key が存在する][ruby]{
require 'net/http'

uri = URI.parse('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-length">
end

//}

//emlist[例 key , default を指定][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", "defau...

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

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

...) とは nth 番目の要素が存在しない場合の振舞いが異
なります。最初の形式では、例外 IndexError が発生します。
二番目の形式では、引数 ifnone を返します。
三番目の形式では、ブロックを評価した結果を返します。

@param nth...
...@raise IndexError 引数 ifnone もブロックも指定しておらず、 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
//}...

絞り込み条件を変える

Gem::SpecFetcher#find_matching(dependency, all = false, matching_platform = true) -> Array (15400.0)

依存関係を満たす gemspec の名前の配列を返します。

...返します。

@param dependency 依存関係を指定します。
@param all 真を指定するとマッチする全てのバージョンの情報を返します。
@param matching_platform 偽を指定すると全てのプラットフォームの情報を返します。

@see Gem::Dependency...

Data.define(*args) -> Class (6172.0)

Data クラスに新しいサブクラスを作って、それを返します。

...ドが定義されています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # => "Fred"
p fred.age # => 5
//}

メンバの値を書き換えることはできません。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)...
.../emlist[例][ruby]{
class HTTPFetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
i
f url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end

end

end


def fetch(url)
fetch
er...
...= HTTPFetcher.new
case fetcher.get(url)
i
n HTTPFetcher::Response(body)
body
i
n HTTPFetcher::NotFound
:NotFound
end

end


p fetch("http://example.com/") # => "Current time is 2023-01-10 10:00:53 +0900"
p fetch("http://example.com/404") # => :NotFound
//}

@param args 値オブジ...

Data.define(*args) {|subclass| block } -> Class (6172.0)

Data クラスに新しいサブクラスを作って、それを返します。

...ドが定義されています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # => "Fred"
p fred.age # => 5
//}

メンバの値を書き換えることはできません。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)...
.../emlist[例][ruby]{
class HTTPFetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
i
f url == "http://example.com/"
Response.new(body: "Current time is #{Time.now}")
else
NotFound.new
end

end

end


def fetch(url)
fetch
er...
...= HTTPFetcher.new
case fetcher.get(url)
i
n HTTPFetcher::Response(body)
body
i
n HTTPFetcher::NotFound
:NotFound
end

end


p fetch("http://example.com/") # => "Current time is 2023-01-10 10:00:53 +0900"
p fetch("http://example.com/404") # => :NotFound
//}

@param args 値オブジ...

KeyError#receiver -> object (6112.0)

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

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

例:

h = Hash.new
begin
h.fetch('gumby'*20)
rescue KeyError => e
p e.message # => "key not found: \"gumbygumbygumbygumbygumbygumbygumbygumbygumbygumbygumbygumbyg..."
p h.equal?(e.receiv...
...er) # => true
end
...

net/imap (6054.0)

このライブラリは Internet Message Access Protocol (IMAP) の クライアントライブラリです。2060 を元に 実装されています。

...リは Internet Message Access Protocol (IMAP) の
クライアントライブラリです。2060 を元に
実装されています。

=== IMAP の概要

I
MAPを利用するには、まずサーバに接続し、
Net::IMAP#authenticate もしくは
Net::IMAP#login で認証します。
I
MAP で...
...クス(INBOX)の送り元とサブジェクトを表示する。
require 'net/imap'

i
map = Net::IMAP.new('mail.example.com')
i
map.authenticate('LOGIN', 'joe_user', 'joes_password')
i
map.examine('INBOX')
i
map.search(["RECENT"]).each do |message_id|
envelope = imap.fetch(message_id, "EN...
...subject}"
end


2003年4月のメールをすべて Mail/sent-mail から "Mail/sent-apr03" へ移動させる

require 'net/imap'

i
map = Net::IMAP.new('mail.example.com')
i
map.authenticate('LOGIN', 'joe_user', 'joes_password')
i
map.select('Mail/sent-mail')
i
f not imap.list('Mail/', 'sen...

絞り込み条件を変える

1.6.8から1.8.0への変更点(まとめ) (1410.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...の変更点(まとめ)/Windows 対応>))
* ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>))
* ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>))
* ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>))
* ((<1.6.8から1.8.0...
...s << Object
p [self.id, self]
class << self
p [self.id, self]
end

end

=> ruby 1.6.7 (2002-03-01) [i586-linux]
[537771634, Class]
[537742484, Class]
=> ruby 1.7.3 (2002-09-05) [i586-linux]
[537771634, #...
...(ARGF.filename の別名) ((<ruby-dev:20197>))

=== Array

: ((<Array#transpose|Array/transpose>)) [new]

追加

: ((<Array#zip|Enumerable/zip>)) [new]
: ((<Enumerable#zip|Enumerable/zip>)) [new]

追加

: ((<Array#fetch|Array/fetch>)) [new]

追加

: ((<Array#insert|Array/insert>))...

Thread#[](name) -> object | nil (124.0)

name に対応したスレッドに固有のデータを取り出します。 name に対応するスレッド固有データがなければ nil を返し ます。

...取り出します。
name に対応するスレッド固有データがなければ nil を返し
ます。

@param name スレッド固有データのキーを文字列か Symbol で指定します。

//emlist[例][ruby]{
[
Thread.new { Thread.current["name"] = "A" },
Thread.new { Thread.curr...
...= "C" }
].each do |th|
th.join
puts "#{th.inspect}: #{th[:name]}"
end


# => #<Thread:0x00000002a54220 dead>: A
# => #<Thread:0x00000002a541a8 dead>: B
# => #<Thread:0x00000002a54130 dead>: C
//}

Thread#[] と Thread#[]= を用いたスレッド固有の変数は
Fiber を切り替えると異...
...rrent[:name]
# => nil if fiber-local
# => 2 if thread-local (The value 2 is leaked to outside of meth method.)
//}

Fiber を切り替えても同じ変数を返したい場合は
Thread#thread_variable_get と Thread#thread_variable_set
を使用してください。

@see Thread#fetch, Thread#[]=...
<< 1 2 > >>