Class: Timezone::Lookup::Test
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Basic
|
|
Instance Chain:
self,
Basic
|
|
Inherits: |
Timezone::Lookup::Basic
|
Defined in: | lib/timezone/lookup/test.rb |
Class Method Summary
Instance Attribute Summary
Instance Method Summary
- #default(timezone)
- #lookup(lat, long)
- #stub(lat, long, timezone)
- #unstub(lat, long)
- #key(lat, long) private
Basic
- Inherited
Constructor Details
.new(_config) ⇒ Test
# File 'lib/timezone/lookup/test.rb', line 10
def initialize(_config) @stubs = {} @default_stub = nil end
Instance Method Details
#default(timezone)
[ GitHub ]# File 'lib/timezone/lookup/test.rb', line 23
def default(timezone) @default_stub = timezone end
#key(lat, long) (private)
[ GitHub ]# File 'lib/timezone/lookup/test.rb', line 35
def key(lat, long) "#{lat},#{long}" end
#lookup(lat, long)
[ GitHub ]#stub(lat, long, timezone)
[ GitHub ]# File 'lib/timezone/lookup/test.rb', line 15
def stub(lat, long, timezone) @stubs[key(lat, long)] = timezone end
#unstub(lat, long)
[ GitHub ]# File 'lib/timezone/lookup/test.rb', line 19
def unstub(lat, long) @stubs.delete(key(lat, long)) end