value -> nil
[permalink][rdoc]レスポンスが 2xx(成功)でなかった場合に、対応する例外を発生させます。
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.value # => nil
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