Sha256: e57eeb727787d8e4cb3a9c147669171f3dd33f1b46a0a65316d1310a64131d1d

Contents?: true

Size: 636 Bytes

Versions: 4

Compression:

Stored size: 636 Bytes

Contents

module Geolookup
  module USA
    module Zipcodes
      # In the future if zip information is updated in mysql, the yml can be recreated via the following
      # zip_lat_long_data = {}
      # ZipCityGeolocationMapping.find_each {|zip| zip_lat_long_data[zip.zip] = {lat_int: zip.lat_int, long_int: zip.long_int}}
      # File.open('ZIP_LAT_LONG.yml', "w") {|file| file.puts zip_lat_long_data.to_yaml}

      ZIP_LAT_LONG_FILE = 'ZIP_LAT_LONG.yml'

      def self.lat_long(zipcode)
        @zip_lat_long_hash ||= Geolookup.load_hash_from_file(ZIP_LAT_LONG_FILE)
        @zip_lat_long_hash[zipcode.to_i] || {}
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geolookup-0.6.4 lib/geolookup/usa/zipcodes.rb
geolookup-0.6.2 lib/geolookup/usa/zipcodes.rb
geolookup-0.6.1 lib/geolookup/usa/zipcodes.rb
geolookup-0.6.0 lib/geolookup/usa/zipcodes.rb