Class: SoraGeocoding::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/sora_geocoding/base.rb

Direct Known Subclasses

Geohash, Query, Request, Url

Instance Method Summary collapse

Instance Method Details

#configuration ⇒ Object

specific config data



16
17
18
# File 'lib/sora_geocoding/base.rb', line 16

def configuration
  SoraGeocoding.config_for_lookup(handle)
end

#handle ⇒ Object

Symbol which is used in configuration to refer to this Lookup.



8
9
10
11
# File 'lib/sora_geocoding/base.rb', line 8

def handle
  str = self.class.to_s
  str[str.rindex(':') + 1..-1].gsub(/([a-z\d]+)([A-Z])/, '\1_\2').downcase.to_sym
end

#raise_error(error, message = nil) ⇒ Object

Raise exception. Return false if exception not raised.

Raises:

  • (error)


24
25
26
27
28
29
# File 'lib/sora_geocoding/base.rb', line 24

def raise_error(error, message = nil)
  exceptions = configuration.always_raise
  raise error, message if (exceptions == :all) || exceptions.include?(error.is_a?(Class) ? error : error.class)

  false
end