Class: Sinew::RuntimeOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/sinew/runtime_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRuntimeOptions

Returns a new instance of RuntimeOptions.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sinew/runtime_options.rb', line 13

def initialize
  self.retries = 3
  self.rate_limit = 1
  self.headers = {
    'User-Agent' => "sinew/#{VERSION}",
  }
  self.httparty_options = {}
  self.before_generate_cache_key = ->(i) { i }

  # for testing
  if ENV['SINEW_TEST']
    self.rate_limit = 0
  end
end

Instance Attribute Details

#before_generate_cache_keyObject

Returns the value of attribute before_generate_cache_key.



11
12
13
# File 'lib/sinew/runtime_options.rb', line 11

def before_generate_cache_key
  @before_generate_cache_key
end

#headersObject

Returns the value of attribute headers.



9
10
11
# File 'lib/sinew/runtime_options.rb', line 9

def headers
  @headers
end

#httparty_optionsObject

Returns the value of attribute httparty_options.



10
11
12
# File 'lib/sinew/runtime_options.rb', line 10

def httparty_options
  @httparty_options
end

#rate_limitObject

Returns the value of attribute rate_limit.



8
9
10
# File 'lib/sinew/runtime_options.rb', line 8

def rate_limit
  @rate_limit
end

#retriesObject

Returns the value of attribute retries.



7
8
9
# File 'lib/sinew/runtime_options.rb', line 7

def retries
  @retries
end