Module: Geocoder

Defined in:
lib/geo-calculator/sql.rb,
lib/geo-calculator/store/base.rb,
lib/geo-calculator/calculations.rb,
lib/geo-calculator/configuration.rb,
lib/geo-calculator/configuration_hash.rb

Defined Under Namespace

Modules: Calculations, Sql, Store Classes: Configuration, ConfigurationHash

Class Method Summary collapse

Class Method Details

.configObject

Read-only access to the singleton’s config data.



25
26
27
# File 'lib/geo-calculator/configuration.rb', line 25

def self.config
  Configuration.instance.data
end

.config_for_lookup(lookup_name) ⇒ Object

Read-only access to lookup-specific config data.



32
33
34
35
36
37
38
39
# File 'lib/geo-calculator/configuration.rb', line 32

def self.config_for_lookup(lookup_name)
  data = config.clone
  data.reject!{ |key,value| !Configuration::OPTIONS.include?(key) }
  if config.has_key?(lookup_name)
    data.merge!(config[lookup_name])
  end
  data
end

.configure(options = nil, &block) ⇒ Object

Configuration options should be set by passing a hash:

Geocoder.configure(
  :timeout  => 5,
  :lookup   => :yandex,
  :api_key  => "2a9fsa983jaslfj982fjasd",
  :units    => :km
)


16
17
18
19
20
# File 'lib/geo-calculator/configuration.rb', line 16

def self.configure(options = nil, &block)
  if !options.nil?
    Configuration.instance.configure(options)
  end
end