るりまサーチ

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

別のキーワード

  1. argf.class each
  2. argf.class each_line
  3. argf.class lines
  4. class new
  5. argf.class gets

ライブラリ

キーワード

検索結果

Net::HTTPResponse::CODE_CLASS_TO_OBJ -> Hash (6108.0)

HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を あらわすクラスへのハッシュです。

...HTTP レスポンスステータスコードの最初の数字からレスポンスのクラス(分類)を
あらわすクラスへのハッシュです。

//emlist[][ruby]{
require 'net/http'
Net::HTTPResponse
::CODE_CLASS_TO_OBJ['3'] # => Net::HTTPRedirection
//}...

Net::HTTPResponse#value -> nil (7.0)

レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。

...lue # => nil
//}

//emlist[例 レスポンスが 2xx以外][ruby]{
require 'net/http'

uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin
response.value
rescue => e
e.class # => Net::HTTPServerException
e.message # => 404 "Not Found"
end
//}...