Sha256: 301b0f7126c3665f984bb20496b682b161f7869a668ad3e902a40e566c4ece45

Contents?: true

Size: 702 Bytes

Versions: 3

Compression:

Stored size: 702 Bytes

Contents

require 'timeout'

module SoraGeocoding
  class Base
    #
    # Symbol which is used in configuration to refer to this Lookup.
    #
    def handle
      str = self.class.to_s
      str[str.rindex(':') + 1..-1].gsub(/([a-z\d]+)([A-Z])/, '\1_\2').downcase.to_sym
    end

    #
    # specific config data
    #
    def configuration
      SoraGeocoding.config_for_lookup(handle)
    end

    #
    # Raise exception.
    # Return false if exception not raised.
    #
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sora_geocoding-0.2.2 lib/sora_geocoding/base.rb
sora_geocoding-0.2.0 lib/sora_geocoding/base.rb
sora_geocoding-0.1.0 lib/sora_geocoding/base.rb