るりまサーチ

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

別のキーワード

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

検索結果

Gem::RemoteFetcher.fetcher=(fetcher) (27300.0)

テスト用のメソッドです。

テスト用のメソッドです。

Gem::SpecFetcher.fetcher=(fetcher) (27300.0)

@todo

@todo

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

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

...Fetcher
Response = Data.define(:body)
NotFound = Data.define

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

def fetch(url)
fetcher =
HTTPFetcher.new
case fetch...
...er.get(url)
in HTTPFetcher::Response(body)
body
in 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 (24.0)

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

...Fetcher
Response = Data.define(:body)
NotFound = Data.define

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

def fetch(url)
fetcher =
HTTPFetcher.new
case fetch...
...er.get(url)
in HTTPFetcher::Response(body)
body
in 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 値オブジェクトのクラスを定義...