Class: Countries::PhoneNumbers::StartWithDetector
- Defined in:
- lib/countries/phone_numbers/start_with_detector.rb
Instance Attribute Summary
Attributes inherited from Detector
#applies_to, #country_codes, #default
Instance Method Summary collapse
-
#initialize(config) ⇒ StartWithDetector
constructor
A new instance of StartWithDetector.
Methods inherited from Detector
#find_all_by_phone_number, #find_all_countries_by_phone_number, #find_by_phone_number, #find_country_by_phone_number
Constructor Details
#initialize(config) ⇒ StartWithDetector
Returns a new instance of StartWithDetector.
3 4 5 6 7 8 9 10 11 |
# File 'lib/countries/phone_numbers/start_with_detector.rb', line 3 def initialize( config ) super config self.country_codes = config['start_with'] # Standardise all country codes self.country_codes.each do |alpha2, codes| self.country_codes[alpha2.to_s] = codes.map{ |code| code.to_s } end end |