1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
zverok 2019-10-26 12:21:33 +03:00 committed by Takashi Kokubun
parent f93cb6904c
commit 6221248294
Notes: git 2019-10-27 02:25:03 +09:00
2 changed files with 12 additions and 6 deletions

View file

@ -1,8 +1,8 @@
# frozen_string_literal: false # frozen_string_literal: false
# HTTPGenericRequest is the parent of the HTTPRequest class. # HTTPGenericRequest is the parent of the Net::HTTPRequest class.
# Do not use this directly; use a subclass of HTTPRequest. # 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 class Net::HTTPGenericRequest

View file

@ -8,11 +8,13 @@
# header values both via hash-like methods and via individual readers. # header values both via hash-like methods and via individual readers.
# #
# Note that each possible HTTP response code defines its own # 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 # Correspondense <code>HTTP code => class</code> is stored in CODE_TO_OBJ
# inheritance. For a list of the classes see Net::HTTP. # constant:
# #
# Net::HTTPResponse::CODE_TO_OBJ['404'] #=> Net::HTTPNotFound
# #
class Net::HTTPResponse class Net::HTTPResponse
class << self class << self
@ -174,6 +176,10 @@ class Net::HTTPResponse
# If a block is given, the body is passed to the block, and # 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. # 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 # Calling this method a second or subsequent time for the same
# HTTPResponse object will return the value already read. # HTTPResponse object will return the value already read.
# #