Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Enhanced RDoc for Net::HTTP #92

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ def ipaddr=(addr)
#
# Argument +retries+ must be a non-negative numeric value:
#
# http = Net::HTTP.new(hostname)
# http.max_retries = 2 # => 2
# http.max_retries # => 2
#
Expand All @@ -1049,13 +1050,27 @@ def max_retries=(retries)

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
Expand Down