Class: Phonelib::DataImporter::Importer

Inherits:
Object
  • Object
show all
Includes:
Phonelib::DataImporterHelper
Defined in:
lib/phonelib/data_importer.rb

Constant Summary collapse

DOUBLE_COUNTRY_CODES_COUNTRIES =

countries that can have double country prefix in number

%w(IN DE BR IT NO PL CU VN)
MAIN_FILE =

main data file in repo

'resources/PhoneNumberMetadata.xml'
SHORT_DATA_FILE =

short number metadata

'resources/ShortNumberMetadata.xml'
FORMATS_FILE =

alternate formats data file in repo

'resources/PhoneNumberAlternateFormats.xml'
GEOCODING_DIR =

geocoding data dir in repo

'resources/geocoding/en/'
CARRIER_DIR =

carrier data dir in repo

'resources/carrier/en/'
TIMEZONES_DIR =

timezones data dir in repo

'resources/timezones/'

Constants included from Phonelib::DataImporterHelper

Phonelib::DataImporterHelper::XML_COMMENT_ATTRIBUTES, Phonelib::DataImporterHelper::XML_FORMAT_NAMES

Instance Method Summary collapse

Methods included from Phonelib::DataImporterHelper

#camel2snake, #file_path, #fill_prefixes, #hash_from_xml, #main_from_xml, #name2sym, #not_format?, #parse_raw_file, #possible_length_regex, #save_data_file, #save_extended_data_file, #str_clean, #without_comments

Constructor Details

#initializeImporter

class initialization method



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/phonelib/data_importer.rb', line 37

def initialize
  @destination = File.path(
    "#{File.dirname(__FILE__)}/../../data/libphonenumber/")
  @data = {}
  @prefixes = {}
  @geo_names = []
  @timezones = []
  @carriers = []
  @countries = {}

  run_import
end