Sha256: a40961899c99419b2ef5f3defdd85bffa15973ca1d37d1f28123eb53088fd729
Contents?: true
Size: 604 Bytes
Versions: 17
Compression:
Stored size: 604 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').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
17 entries across 17 versions & 1 rubygems