Sha256: e5bbf9d5185be205b89bb24ecc1ed1448cf4bc476fedac1032b29d82211b3ff6
Contents?: true
Size: 610 Bytes
Versions: 14
Compression:
Stored size: 610 Bytes
Contents
module TelephoneNumber class GeoLocationDataImporter def self.load_data! Dir.glob("data/geocoding/**/*.txt").each { |file| process_file(file) } end def self.process_file(file_path) master_data = {} bin_file_path = "#{File.dirname(file_path)}/#{File.basename(file_path, '.txt')}.dat" File.open(file_path, 'r:UTF-8').each do |row| next if row.strip !~ /^[0-9]/ number, location = row.split('|') master_data[number.strip] = location.strip end File.open(bin_file_path, 'wb'){ |file| file << Marshal.dump(master_data) } end end end
Version data entries
14 entries across 14 versions & 1 rubygems