Class: EarthTools::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/earth_tools/configuration.rb

Constant Summary collapse

OPTIONS =
[
  :timeout,
  :proxy,
  :cache,
  :cache_prefix,
  :always_raise,
  :units
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

:nodoc



29
30
31
# File 'lib/earth_tools/configuration.rb', line 29

def initialize  # :nodoc
  set_defaults
end

Class Method Details

.set_defaultsObject

This method will set the configuration options to the default values



67
68
69
# File 'lib/earth_tools/configuration.rb', line 67

def set_defaults
  instance.set_defaults
end

Instance Method Details

#set_defaultsObject

This method will set the configuration options to the default values



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/earth_tools/configuration.rb', line 34

def set_defaults
  @timeout      = 3               # geocoding service timeout (secs)
  @proxy        = nil             # HTTP proxy server (user:pass@host:port)
  @cache        = nil             # cache object (must respond to #[], #[]=, and #keys)
  @cache_prefix = "earth_tools:"  # prefix (string) to use for all cache keys

  # exceptions that should not be rescued by default
  # (if you want to implement custom error handling);
  # supports SocketError and Timeout::Error
  @always_raise = []

  # calculation options
  @units     = :english # :metric or :english
end