Class: Geocoder::Configuration

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

Class Method Summary collapse

Class Method Details

.options_and_defaultsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/geocoder/configuration.rb', line 4

def self.options_and_defaults
  [
    # geocoding service timeout (secs)
    [:timeout, 3],

    # name of geocoding service (symbol)
    [:lookup, :google],

    # ISO-639 language code
    [:language, :en],

    # use HTTPS for lookup requests? (if supported)
    [:use_https, false],

    # API key for geocoding service
    [:api_key, nil],

    # cache object (must respond to #[], #[]=, and #keys)
    [:cache, nil],

    # prefix (string) to use for all cache keys
    [:cache_prefix, "geocoder:"]
  ]
end

.set_defaultsObject

Set all values to default.



45
46
47
48
49
# File 'lib/geocoder/configuration.rb', line 45

def self.set_defaults
  self.options_and_defaults.each do |o,d|
    self.send("#{o}=", d)
  end
end

.yahoo_app_id=(value) ⇒ Object

legacy support



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

def self.yahoo_app_id=(value)
  warn "DEPRECATION WARNING: Geocoder's 'yahoo_app_id' setting has been replaced by 'api_key'. " +
    "This method will be removed in Geocoder v1.0."
  @@api_key = value
end