lib/zip2tz.rb in zip2tz-0.1.0 vs lib/zip2tz.rb in zip2tz-0.1.1
- old
+ new
@@ -28,10 +28,12 @@
America/Kentucky/Monticello
America/North_Dakota/Center
America/Yakutat
)
- MAP = JSON.parse(File.read('data/map.json'))
+ MAP_PATH = Pathname.new(__dir__).parent.join('data', 'map.json')
+
+ MAP = JSON.parse(MAP_PATH.read)
def self.lookup(zip)
zip = zip.to_s
raise '5 digits required' if zip !~ /\A\d{5}/
fetch(MAP, *zip.chars.first(5).map(&:to_i))