Class: TelephoneNumber::TimeZoneDataImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/importers/time_zone_data_importer.rb

Class Method Summary collapse

Class Method Details

.load_data!Object



3
4
5
6
7
8
9
10
11
# File 'lib/importers/time_zone_data_importer.rb', line 3

def self.load_data!
  master_data = {}
  File.open('data/timezones/map_data.txt', 'rb').each do |row|
    number_prefix, timezone = row.split('|').map(&:strip)
    master_data[number_prefix] = timezone
  end

  File.open('data/timezones/map_data.dat', 'wb') { |file| file << Marshal.dump(master_data) }
end