Sha256: 20409b73288decfbfb21f2fa9a8144d0d8912ea20ee80726e1c35a3ce0c50242
Contents?: true
Size: 699 Bytes
Versions: 4
Compression:
Stored size: 699 Bytes
Contents
# frozen_string_literal: true require 'timezone/lookup/basic' require 'timezone/error' module Timezone module Lookup # @!visibility private class Test < ::Timezone::Lookup::Basic def initialize(_config) @stubs = {} @default_stub = nil end def stub(lat, long, timezone) @stubs[key(lat, long)] = timezone end def default(timezone) @default_stub = timezone end def lookup(lat, long) @stubs.fetch(key(lat, long)) do @default_stub || raise(::Timezone::Error::Test, 'missing stub') end end private def key(lat, long) "#{lat},#{long}" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
timezone-1.2.12 | lib/timezone/lookup/test.rb |
timezone-1.2.11 | lib/timezone/lookup/test.rb |
timezone-1.2.10 | lib/timezone/lookup/test.rb |
timezone-1.2.9 | lib/timezone/lookup/test.rb |