Class: EarthTools::Configuration

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

Overview

The singleton that maintains the configuration settings for plugin.

Constant Summary collapse

OPTIONS =

The available options

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

:nodoc



33
34
35
# File 'lib/earth_tools/configuration.rb', line 33

def initialize  # :nodoc
  set_defaults
end

Class Method Details

.set_defaultsObject

Sets the configuration options to the default values



71
72
73
# File 'lib/earth_tools/configuration.rb', line 71

def set_defaults
  instance.set_defaults
end

Instance Method Details

#set_defaultsObject

Sets the configuration options to the default values



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/earth_tools/configuration.rb', line 39

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 #[], #[]=, #keys, and #delete)
  @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