Class: Timezone::Lookup::Basic Abstract
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | lib/timezone/lookup/basic.rb |
Overview
This class is abstract.
Subclass and override #lookup to implement a custom ::Timezone::Lookup
class.
Class Method Summary
- .new(config) ⇒ Basic constructor
Instance Attribute Summary
- #config readonly
Instance Method Summary
-
#client ⇒ #get
Returns an instance of the request handler.
-
#lookup(_lat, _long) ⇒ String?
Returns a timezone name for a given lat, long pair.
Constructor Details
.new(config) ⇒ Basic
# File 'lib/timezone/lookup/basic.rb', line 14
def initialize(config) if config.protocol.nil? raise(::Timezone::Error::InvalidConfig, 'missing protocol') end if config.url.nil? raise(::Timezone::Error::InvalidConfig, 'missing url') end config.uri ||= URI.parse("#{config.protocol}://#{config.url}") @config = config end
Instance Attribute Details
#config (readonly)
[ GitHub ]# File 'lib/timezone/lookup/basic.rb', line 10
attr_reader :config
Instance Method Details
#client ⇒ #get
Returns an instance of the request handler.
#lookup(_lat, _long) ⇒ String
?
Returns a timezone name for a given lat, long pair.
# File 'lib/timezone/lookup/basic.rb', line 44
def lookup(_lat, _long) raise NoMethodError, 'lookup is not implemented' end