itu_codes 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,13 +12,6 @@
12
12
  # * http://www.itu.int/pub/T-SP-E.164D-11-2011
13
13
  # * vendor/itu/T-SP-E.164D-11-2011-PDF-E.pdf
14
14
 
15
- # The following 3 names used by the ITU do not have an ISO-3166-1
16
- # 2 letter code:
17
- #
18
- # - Diego Garcia
19
- # - French Departments and Territories in the Indian Ocean
20
- # - Australian External Territories
21
-
22
15
  AD: Andorra (Principality of)
23
16
  AE: United Arab Emirates
24
17
  AF: Afghanistan
@@ -215,6 +208,7 @@ SY: Syrian Arab Republic
215
208
  SZ: Swaziland (Kingdom of)
216
209
  TC: Turks and Caicos Islands
217
210
  TD: Chad (Republic of)
211
+ TF: French Departments and Territories in the Indian Ocean
218
212
  TG: Togolese Republic
219
213
  TH: Thailand
220
214
  TJ: Tajikistan (Republic of)
@@ -245,4 +239,25 @@ WS: Samoa (Independent State of)
245
239
  YE: Yemen (Republic of)
246
240
  ZA: South Africa (Republic of)
247
241
  ZM: Zambia (Republic of)
248
- ZW: Zimbabwe (Republic of)
242
+ ZW: Zimbabwe (Republic of)
243
+
244
+ # Diego Garcia is not included in the XML file provided by ISO
245
+ # ISO 2 letter code provided on request of ITU:
246
+ # http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm#DG
247
+ DG: Diego Garcia
248
+
249
+ # Australian External Territories
250
+ # The ITU code 672 is defined in the PDF file provided by ITU
251
+ # as being assigned to the "Australian External Territories"
252
+ # However, the ITU website defines 672 for "Norfolk Island"
253
+ # see: http://www.itu.int/oth/T0202.aspx?parent=T0202
254
+ # To make the matter more confusing, ISO defines 4 separate ISO
255
+ # codes for the Australian external territories:
256
+ # http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm#CC
257
+ # http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm#CX
258
+ # http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm#HM
259
+ # http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm#NF
260
+ CC: Australian External Territories
261
+ CX: Australian External Territories
262
+ HM: Australian External Territories
263
+ NF: Australian External Territories
@@ -6,7 +6,15 @@ module ItuCodes
6
6
 
7
7
  # country name is the one used by ITU, not ISO
8
8
  def self.country_code_lookup(country_name)
9
- ISO2ITU.key(country_name)
9
+ codes = ISO2ITU.select{|k,v| v === country_name}.keys
10
+
11
+ if codes.empty?
12
+ nil
13
+ elsif codes.size === 1
14
+ codes.first
15
+ else
16
+ codes
17
+ end
10
18
  end
11
19
 
12
20
  def self.country_name_lookup(iso_code)
@@ -1,3 +1,3 @@
1
1
  module ItuCodes
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itu_codes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: