Method: Hiredis::Ruby::Connection#timeout=

Defined in:
lib/hiredis/ruby/connection.rb

#timeout=(usecs) ⇒ Object

Raises:

  • (ArgumentError)


223
224
225
226
227
228
229
230
231
232
233
# File 'lib/hiredis/ruby/connection.rb', line 223

def timeout=(usecs)
  raise ArgumentError.new("timeout cannot be negative") if usecs < 0

  if usecs == 0
    @timeout = nil
  else
    @timeout = usecs / 1_000_000.0
  end

  nil
end