Module: Azimuth::Configuration

Included in:
Azimuth
Defined in:
lib/azimuth/configuration.rb

Overview

Methods for Azimuth configuration

Constant Summary collapse

VALID_OPTIONS =

Configurable options

[
  :api_endpoint,
  :api_key,
].freeze
DEFAULT_API_ENDPOINT =

Default MapQuest Directions API endpoint

'http://www.mapquestapi.com/directions/v2/'

Instance Method Summary collapse

Instance Method Details

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

Set configuration options using a block

Yields:

  • (_self)

Yield Parameters:



21
22
23
# File 'lib/azimuth/configuration.rb', line 21

def configure
  yield self
end

#initialize_default_optionsObject

Initialize default options



31
32
33
34
# File 'lib/azimuth/configuration.rb', line 31

def initialize_default_options
  self.api_endpoint = DEFAULT_API_ENDPOINT
  self.api_key = nil
end

#optionsObject

Default options



26
27
28
# File 'lib/azimuth/configuration.rb', line 26

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

#reset!Object

Reset configuration options to default values



37
38
39
40
41
# File 'lib/azimuth/configuration.rb', line 37

def reset!
  initialize_default_options

  self
end