diff options
author | zverok <zverok.offline@gmail.com> | 2019-10-26 12:21:33 +0300 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-10-26 10:24:20 -0700 |
commit | 62212482947066d2cbf4dad6ebe60facf35ef223 (patch) | |
tree | 81ebda658d67742d3e60cc87b76111ea9c07b462 /lib | |
parent | f93cb6904c69de51bf14b1bcf9fcfc483584f4d3 (diff) |
Improve Net::HTTP docs:
* Make links from Net::GenericHTTPRequest work;
* Document +dest+ param of HTTPResponse#read_body;
* Slightly improve reference to particular response
classes from HTTPResponse class docs.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2615
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/http/generic_request.rb | 6 | ||||
-rw-r--r-- | lib/net/http/response.rb | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb index 3ff6d88f0c..003f59d0ac 100644 --- a/lib/net/http/generic_request.rb +++ b/lib/net/http/generic_request.rb @@ -1,8 +1,8 @@ # frozen_string_literal: false -# HTTPGenericRequest is the parent of the HTTPRequest class. -# Do not use this directly; use a subclass of HTTPRequest. +# HTTPGenericRequest is the parent of the Net::HTTPRequest class. +# Do not use this directly; use a subclass of Net::HTTPRequest. # -# Mixes in the HTTPHeader module to provide easier access to HTTP headers. +# Mixes in the Net::HTTPHeader module to provide easier access to HTTP headers. # class Net::HTTPGenericRequest diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index 66132985d9..8dd5944829 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -8,11 +8,13 @@ # header values both via hash-like methods and via individual readers. # # Note that each possible HTTP response code defines its own -# HTTPResponse subclass. These are listed below. +# HTTPResponse subclass. All classes are defined under the Net module. +# Indentation indicates inheritance. For a list of the classes see Net::HTTP. # -# All classes are defined under the Net module. Indentation indicates -# inheritance. For a list of the classes see Net::HTTP. +# Correspondense <code>HTTP code => class</code> is stored in CODE_TO_OBJ +# constant: # +# Net::HTTPResponse::CODE_TO_OBJ['404'] #=> Net::HTTPNotFound # class Net::HTTPResponse class << self @@ -174,6 +176,10 @@ class Net::HTTPResponse # If a block is given, the body is passed to the block, and # the body is provided in fragments, as it is read in from the socket. # + # If +dest+ argument is given, response is read into that variable, + # with <code>dest#<<</code> method (it could be String or IO, or any + # other object responding to <code><<</code>). + # # Calling this method a second or subsequent time for the same # HTTPResponse object will return the value already read. # |