Class: NxtHttpClient::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/nxt_http_client/config.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



19
20
21
22
23
# File 'lib/nxt_http_client/config.rb', line 19

def initialize
  CONFIGURABLE_OPTIONS.each do |key, default_value|
    self.send(:"#{key}=", default_value.dup)
  end
end

Instance Method Details

#dupObject



31
32
33
34
35
36
37
38
# File 'lib/nxt_http_client/config.rb', line 31

def dup
  options = to_h
  self.class.new.tap do |instance|
    options.each do |key, value|
      instance.send(:"#{key}=", value.dup)
    end
  end
end

#timeout_seconds(total:, connect: nil) ⇒ Object



25
26
27
28
29
# File 'lib/nxt_http_client/config.rb', line 25

def timeout_seconds(total:, connect: nil)
  timeouts = { total:, connect:, }.compact

  self.timeouts = timeouts
end