Skip to content

Commit 553c8b9

Browse files
authored
Merge pull request #92 from BurdetteLamar/http_doc
[DOC] Enhanced RDoc for Net::HTTP
2 parents d394404 + da626e4 commit 553c8b9

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lib/net/http.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ def ipaddr=(addr)
10361036
#
10371037
# Argument +retries+ must be a non-negative numeric value:
10381038
#
1039+
# http = Net::HTTP.new(hostname)
10391040
# http.max_retries = 2 # => 2
10401041
# http.max_retries # => 2
10411042
#
@@ -1049,13 +1050,27 @@ def max_retries=(retries)
10491050

10501051
attr_reader :max_retries
10511052

1052-
# Setter for the read_timeout attribute.
1053+
# Sets the read timeout, in seconds, for +self+ to integer +sec+;
1054+
# the initial value is 60.
1055+
#
1056+
# Argument +sec+ must be a non-negative numeric value:
1057+
#
1058+
# http = Net::HTTP.new(hostname)
1059+
# http.read_timeout # => 60
1060+
# http.get('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true>
1061+
# http.read_timeout = 0
1062+
# http.get('/todos/1') # Raises Net::ReadTimeout.
1063+
#
10531064
def read_timeout=(sec)
10541065
@socket.read_timeout = sec if @socket
10551066
@read_timeout = sec
10561067
end
10571068

1058-
# Setter for the write_timeout attribute.
1069+
# Sets the write timeout, in seconds, for +self+ to integer +sec+;
1070+
# the initial value is 60.
1071+
#
1072+
# Argument +sec+ must be a non-negative numeric value.
1073+
#
10591074
def write_timeout=(sec)
10601075
@socket.write_timeout = sec if @socket
10611076
@write_timeout = sec

0 commit comments

Comments
 (0)