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
28
29
30
31
32
33
34
35
36
37
38
# 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],

    # HTTP proxy server (user:pass@host:port)
    [:http_proxy, nil],

    # HTTPS proxy server (user:pass@host:port)
    [:https_proxy, nil],

    # 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:"],

    # exceptions that should not be rescued by default
    # (if you want to implement custom error handling);
    # supports SocketError and TimeoutError
    [:always_raise, []]
  ]
end

.set_defaultsObject

Set all values to default.



49
50
51
52
53
# File 'lib/geocoder/configuration.rb', line 49

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