From 132fe2c90f4737b3cb2ceeec830b0dea4e011438 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Tue, 21 Feb 2023 15:34:17 +0000 Subject: [PATCH 1/3] Enhanced RDoc for Net:HTTP --- lib/net/http.rb | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index 75fdef91..c4e452ce 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1090,7 +1090,7 @@ def write_timeout=(sec) end # Returns the continue timeout value. - # See Net::HTTP.continue_timeout=. + # See Net::HTTP.continue_timeout=. # attr_reader :continue_timeout @@ -1847,30 +1847,27 @@ def trace(path, initheader = nil) request(Trace.new(path, initheader)) end - # Sends a GET request to the +path+. - # Returns the response as a Net::HTTPResponse object. + # Sends a GET request to the server; + # forms the response into a Net::HTTPResponse object. # - # When called with a block, passes an HTTPResponse object to the block. - # The body of the response will not have been read yet; - # the block can process it using HTTPResponse#read_body, - # if desired. + # The request is based on the Net::HTTP::Get object + # created from string +path+ and initial headers hash +initheader+. # - # Returns the response. + # With no block given, returns the response object (with the body already read): # - # This method never raises Net::* exceptions. + # http.request_get('/todos') # => # # - # response = http.request_get('/index.html') - # # The entity body is already read in this case. - # p response['content-type'] - # puts response.body + # With a block given, calls the block with the response object + # (with the body _not_ already read), + # and returns the response object (_with_ the body already read): # - # # Using a block - # http.request_get('/index.html') {|response| - # p response['content-type'] - # response.read_body do |str| # read body now - # print str - # end - # } + # http.request_get('/todos') do |res| + # p res + # end # => # + # + # Output: + # + # # # def request_get(path, initheader = nil, &block) # :yield: +response+ request(Get.new(path, initheader), &block) From d26b0346eb8fa3b5404f861349620ac85f94ed57 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Tue, 21 Feb 2023 20:09:20 +0000 Subject: [PATCH 2/3] Enhanced RDoc for Net:HTTP --- lib/net/http.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/net/http.rb b/lib/net/http.rb index c4e452ce..e0354c34 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1855,6 +1855,7 @@ def trace(path, initheader = nil) # # With no block given, returns the response object (with the body already read): # + # http = Net::HTTP.new(hostname) # http.request_get('/todos') # => # # # With a block given, calls the block with the response object From 116e8e67efd17de343836af82583fbec800ebf8c Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Tue, 21 Feb 2023 21:08:55 +0000 Subject: [PATCH 3/3] Enhanced RDoc for Net:HTTP --- lib/net/http.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index e0354c34..44a91784 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1090,7 +1090,7 @@ def write_timeout=(sec) end # Returns the continue timeout value. - # See Net::HTTP.continue_timeout=. + # See Net::HTTP.continue_timeout=. # attr_reader :continue_timeout @@ -1853,14 +1853,13 @@ def trace(path, initheader = nil) # The request is based on the Net::HTTP::Get object # created from string +path+ and initial headers hash +initheader+. # - # With no block given, returns the response object (with the body already read): + # With no block given, returns the response object: # # http = Net::HTTP.new(hostname) # http.request_get('/todos') # => # # # With a block given, calls the block with the response object - # (with the body _not_ already read), - # and returns the response object (_with_ the body already read): + # and returns the response object: # # http.request_get('/todos') do |res| # p res