Class: Readmill::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/readmill/configuration.rb

Overview

Internal: Store all of the configurable options inside of a Configuration class.

Constant Summary collapse

VALID_CONFIGURATION_KEYS =

Public: An Array of all keys that can be configured. This allows us to set instance keys, knowing what can and cannot be modified.

[:client_id, :timeout, :open_timeout, :adapter]

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Internal: Default all of the keys to valid defaults.



31
32
33
34
35
36
# File 'lib/readmill/configuration.rb', line 31

def initialize
  self.client_id         = nil
  self.timeout           = 10
  self.open_timeout      = 10
  self.adapter           = Faraday.default_adapter
end

Instance Method Details

#valuesObject

Public: Return all of the current values.

Returns a Hash.



41
42
43
# File 'lib/readmill/configuration.rb', line 41

def values
  VALID_CONFIGURATION_KEYS.inject({}){|o,k| o.merge!(k => send(k)) }
end