From 273ce98e39fab9af53140d9509c93b087226283d Mon Sep 17 00:00:00 2001 From: amikula Date: Fri, 27 May 2011 16:14:33 -0700 Subject: [PATCH] Clarifying timeout documentation to make it clear that integers are not necessary for timeouts --- lib/net/http.rb | 10 ++++++---- lib/timeout.rb | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index 4faf6c8..7880d20 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -618,13 +618,15 @@ module Net #:nodoc: # The port number to connect to. attr_reader :port - # Number of seconds to wait for the connection to open. - # If the HTTP object cannot open a connection in this many seconds, - # it raises a TimeoutError exception. + # Number of seconds to wait for the connection to open. Any number + # may be used, including Floats for fractional seconds. If the HTTP + # object cannot open a connection in this many seconds, it raises a + # TimeoutError exception. attr_accessor :open_timeout # Number of seconds to wait for one block to be read (via one read(2) - # call). If the HTTP object cannot read data in this many seconds, + # call). Any number may be used, including Floats for fractional + # seconds. If the HTTP object cannot read data in this many seconds, # it raises a TimeoutError exception. attr_reader :read_timeout diff --git a/lib/timeout.rb b/lib/timeout.rb index 4e4612b..91d120a 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -36,7 +36,8 @@ module Timeout # Perform an operation in a block, timing it out if it takes longer # than +sec+ seconds to complete. # - # +sec+:: number of seconds to wait for the block to terminate + # +sec+:: Number of seconds to wait for the block to terminate. Any number + # may be used, including Floats to specify fractional seconds. # +klass+:: Exception Class to raise if the block fails to terminate # in +sec+ seconds. Omitting will use the default, Timeout::Error # -- 1.7.5.2