module Countries::PhoneNumbers

Constants

DATA_FILE
VERSION

Public Class Methods

shared_country_codes() click to toggle source

Find all countries with shared country codes.

# File lib/countries/phone_numbers.rb, line 26
def self.shared_country_codes
  codes = Country.all.map { |cc| Country[cc[1]].country_code }.uniq
  shared = codes.each_with_object({}){ |cc,h| h[cc] = Country.find_all_countries_by_country_code(cc) }
  shared.reject!{ |key,entry| entry.nil? or entry.count <= 1 }
  shared.each{ |cc,countries| shared[cc] = countries.map{ |c| c.name } }
end
unresolved_country_codes() click to toggle source

Find all countries with shared country codes and do not have a dedicated detector.

# File lib/countries/phone_numbers.rb, line 35
def self.unresolved_country_codes
  shared_country_codes.reject{ |key,value| self.phone_number_detector_factory.detector_for? key or key == '' }
end