Module: Arcticelvis::Configuration

Included in:
Arcticelvis
Defined in:
lib/arcticelvis/configuration.rb

Constant Summary collapse

VALID_CONFIG_KEYS =
[:api_key].freeze
DEFAULT_API_KEY =
nil
API_HOST =
"http://api.arcticelvis.com"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

setup defaults on extend



10
11
12
# File 'lib/arcticelvis/configuration.rb', line 10

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



18
19
20
# File 'lib/arcticelvis/configuration.rb', line 18

def configure
  yield self
end

#optionsObject



22
23
24
# File 'lib/arcticelvis/configuration.rb', line 22

def options
  Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
end

#resetObject



14
15
16
# File 'lib/arcticelvis/configuration.rb', line 14

def reset
  self.api_key = DEFAULT_API_KEY
end