Class: Phonelib::DataImporter::Importer
- Inherits:
-
Object
- Object
- Phonelib::DataImporter::Importer
- 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)
- FORMAT_SHARING =
{ 'CA' => 'US', 'CC' => 'AU', 'CX' => 'AU', 'DM' => 'US', 'DO' => 'US', 'EH' => 'MA', 'GD' => 'US', 'GG' => 'GB', 'GU' => 'US', 'IM' => 'GB', 'JE' => 'GB', 'JM' => 'US', 'KN' => 'US', 'KY' => 'US', 'KZ' => 'RU', 'LC' => 'US', 'MF' => 'GP', 'MP' => 'US', 'MS' => 'US', 'PR' => 'US', 'SJ' => 'NO', 'SX' => 'US', 'TA' => 'SH', 'TC' => 'US', 'TT' => 'US', 'UM' => 'US', 'VA' => 'IT', 'VC' => 'US', 'VG' => 'US', 'VI' => 'US', 'YT' => 'RE', 'AG' => 'US', 'AI' => 'US', 'AS' => 'US', 'AX' => 'FI', 'BB' => 'US', 'BL' => 'GP', 'BM' => 'US', 'BQ' => 'CW', 'BS' => 'US', }
- 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
-
#initialize ⇒ Importer
constructor
class initialization method.
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
#initialize ⇒ Importer
class initialization method
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/phonelib/data_importer.rb', line 81 def initialize @destination = File.path( "#{File.dirname(__FILE__)}/../../data/libphonenumber/") @data = {} @prefixes = {} @geo_names = [] @timezones = [] @carriers = [] @countries = {} run_import end |