Module: ItuCodes::Helpers
- Defined in:
- lib/itu_codes/helpers.rb
Constant Summary collapse
- ISO2ITU =
YAML.load_file( File.(File.dirname(__FILE__)) + '/../data/iso_code_to_itu_country_names.yml')
Class Method Summary collapse
-
.country_code_lookup(country_name) ⇒ Object
country name is the one used by ITU, not ISO.
- .country_name_lookup(iso_code) ⇒ Object
Class Method Details
.country_code_lookup(country_name) ⇒ Object
country name is the one used by ITU, not ISO
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/itu_codes/helpers.rb', line 8 def self.country_code_lookup(country_name) codes = ISO2ITU.select{|k,v| v === country_name}.keys if codes.empty? nil elsif codes.size === 1 codes.first else codes end end |
.country_name_lookup(iso_code) ⇒ Object
20 21 22 |
# File 'lib/itu_codes/helpers.rb', line 20 def self.country_name_lookup(iso_code) ISO2ITU[iso_code] end |