summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
authorBurdetteLamar <burdettelamar@yahoo.com>2022-12-15 15:11:06 +0000
committergit <svn-admin@ruby-lang.org>2022-12-15 21:33:19 +0000
commitd5eafaed812bc683d5069154c5c9391ba98ea151 (patch)
treec100e603529b345fcbfeb2d126ce3983c32e4e8e /lib/net
parent4872e8ef14800811d98d3eb6d627386842f87f3f (diff)
[ruby/net-http] Enhanced RDoc for Net::HTTP
https://github.com/ruby/net-http/commit/da626e4e42
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/http.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index e1e61d1f81..efac32aef9 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1036,6 +1036,7 @@ module Net #:nodoc:
#
# Argument +retries+ must be a non-negative numeric value:
#
+ # http = Net::HTTP.new(hostname)
# http.max_retries = 2 # => 2
# http.max_retries # => 2
#
@@ -1049,13 +1050,27 @@ module Net #:nodoc:
attr_reader :max_retries
- # Setter for the read_timeout attribute.
+ # Sets the read timeout, in seconds, for +self+ to integer +sec+;
+ # the initial value is 60.
+ #
+ # Argument +sec+ must be a non-negative numeric value:
+ #
+ # http = Net::HTTP.new(hostname)
+ # http.read_timeout # => 60
+ # http.get('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true>
+ # http.read_timeout = 0
+ # http.get('/todos/1') # Raises Net::ReadTimeout.
+ #
def read_timeout=(sec)
@socket.read_timeout = sec if @socket
@read_timeout = sec
end
- # Setter for the write_timeout attribute.
+ # Sets the write timeout, in seconds, for +self+ to integer +sec+;
+ # the initial value is 60.
+ #
+ # Argument +sec+ must be a non-negative numeric value.
+ #
def write_timeout=(sec)
@socket.write_timeout = sec if @socket
@write_timeout = sec