Class: Nominatim::Configuration

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

Constant Summary collapse

DEFAULT_ENDPOINT =
'http://nominatim.openstreetmap.org'
DEFAULT_KEY =
nil
DEFAULT_USER_AGENT =
"Nominatim Ruby Gem #{Nominatim::VERSION}"
DEFAULT_EMAIL =
nil
DEFAULT_LANGUAGE =
'en'
DEFAULT_TIMEOUT =
nil
DEFAULT_SEARCH_URL =
'search'
DEFAULT_REVERSE_URL =
'reverse'
VALID_OPTIONS_KEYS =
[
  :endpoint,
  :key,
  :user_agent,
  :email,
  :accept_language,
  :timeout,
  :search_url,
  :reverse_url
]

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration


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

def initialize
  reset!
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:


36
37
38
39
# File 'lib/nominatim/configuration.rb', line 36

def configure
  yield self
  self
end

#reset!Object


41
42
43
44
45
46
47
48
49
50
# File 'lib/nominatim/configuration.rb', line 41

def reset!
  self.endpoint         = DEFAULT_ENDPOINT
  self.key              = DEFAULT_KEY
  self.user_agent       = DEFAULT_USER_AGENT
  self.email            = DEFAULT_EMAIL
  self.accept_language  = DEFAULT_LANGUAGE
  self.timeout          = DEFAULT_TIMEOUT
  self.search_url       = DEFAULT_SEARCH_URL
  self.reverse_url      = DEFAULT_REVERSE_URL
end