module HTTP::Chainable
def timeout(klass, options = {})
(**options)
-
:connect
(Float
) -- Connect timeout -
:write
(Float
) -- Write timeout -
:read
(Float
) -- Read timeout
Parameters:
-
options
(Hash
) -- -
klass
(#to_sym
) --
def timeout(klass, options = {}) klass, options = :per_operation, klass if klass.is_a? Hash klass = case klass.to_sym when :null then HTTP::Timeout::Null when :global then HTTP::Timeout::Global when :per_operation then HTTP::Timeout::PerOperation else fail ArgumentError, "Unsupported Timeout class: #{klass}" end [:read, :write, :connect].each do |k| next unless options.key? k options["#{k}_timeout".to_sym] = options.delete k end branch default_options.merge( :timeout_class => klass, :timeout_options => options ) end