Class: Timezone::Lookup::Test
- Defined in:
- lib/timezone/lookup/test.rb
Instance Attribute Summary
Attributes inherited from Basic
Instance Method Summary collapse
-
#initialize(config) ⇒ Test
constructor
A new instance of Test.
- #lookup(lat, lng) ⇒ Object
- #stub(lat, lng, timezone) ⇒ Object
Methods inherited from Basic
Constructor Details
#initialize(config) ⇒ Test
Returns a new instance of Test.
7 8 9 10 |
# File 'lib/timezone/lookup/test.rb', line 7 def initialize(config) @stubs = {} # Regular config w/ protocol and URL checks does not apply for stubs. end |
Instance Method Details
#lookup(lat, lng) ⇒ Object
16 17 18 19 20 |
# File 'lib/timezone/lookup/test.rb', line 16 def lookup(lat, lng) @stubs.fetch(key(lat, lng)) do raise ::Timezone::Error::Test, 'missing stub' end end |
#stub(lat, lng, timezone) ⇒ Object
12 13 14 |
# File 'lib/timezone/lookup/test.rb', line 12 def stub(lat, lng, timezone) @stubs[key(lat, lng)] = timezone end |