namxam-carmen 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,18 +6,31 @@ States are supported for the following countries: Australia, Brazil, Canada, Cub
6
6
 
7
7
  == Installation
8
8
 
9
- gem install carmen
9
+ gem install namxam-carmen
10
10
 
11
11
  If you're in Rails:
12
12
 
13
- config.gem 'carmen', :source => 'http://gemcutter.org'
14
-
13
+ # classic style
14
+ config.gem 'namxam-carmen', :lib => 'carmen', :source => 'http://rubygems.org'
15
+
16
+ # when using rubygems 1.3.6
17
+ config.gem 'namxam-carmen', :lib => 'carmen'
18
+
19
+ # when on rails 3 put this in your Gemfile
20
+ gem "namxam-carmen", :require => "carmen"
21
+
15
22
  Or as a plugin:
16
23
 
17
- script/plugin install git://github.com/jim/carmen
24
+ script/plugin install git://github.com/namxam/carmen
18
25
 
19
- == State list retrieval
20
26
 
27
+ == Get a list of all countries
28
+
29
+ Carmen.countries => […, ['Germany', 'DE'], …, ['United States', 'US'], …]
30
+ Carmen.countries(:locale => 'de') => […, ['Deutschland', 'DE'], …, ['Vereinigte Staaten von Amerika', 'US'], …]
31
+
32
+ == State list retrieval
33
+
21
34
  Carmen::states('US') => [['Alabama', 'AL'], ['Arkansas', 'AR'], ... ]
22
35
  Carmen::states => [['Alabama', 'AL'], ['Arkansas', 'AR'], ... ] # uses default country
23
36
  Carmen::state_names('US') => ['Alabama', 'Arkansas', ... ]
@@ -31,14 +44,6 @@ Or as a plugin:
31
44
  Carmen::state_code('Manitoba', 'CA') => 'MB'
32
45
  Carmen::state_name('AZ') => 'Arizona'
33
46
 
34
- == The Data
35
-
36
- The raw lists are stored in constants
37
-
38
- Carmen::COUNTRIES => [['Afghanistan', 'AF'], ['Aland Islands', 'AX'], ]
39
-
40
- Carmen::STATES => [['US', [['Alabama', 'AL'], ['Arkansas', 'AR'], ... ],
41
- ['CA', [['Alberta', 'AB'], ['British Columbia', 'BC'], ... ]]
42
47
 
43
48
  == Default Country
44
49
 
@@ -54,6 +59,6 @@ You can switch between different localizations of the countries list, by setting
54
59
 
55
60
  Currently included localizations are: English, German
56
61
 
57
- == Documentation
62
+ == Changelog
58
63
 
59
- Carmen's docs are published to http://jim.github.com/carmen
64
+ * 0.1.3 DEPRECATE Carmen::COUNTRIES in favor of Carmen.countries
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{namxam-carmen}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jim Benton", "Maximilian Schulz"]
@@ -25,13 +25,15 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "carmen.gemspec",
28
- "data/countries.yml",
28
+ "data/countries.de.yml",
29
+ "data/countries.en.yml",
29
30
  "data/states/au.yml",
30
31
  "data/states/br.yml",
31
32
  "data/states/ca.yml",
32
33
  "data/states/cu.yml",
33
34
  "data/states/de.yml",
34
35
  "data/states/dk.yml",
36
+ "data/states/es.yml",
35
37
  "data/states/it.yml",
36
38
  "data/states/mx.yml",
37
39
  "data/states/ua.yml",
@@ -0,0 +1,525 @@
1
+ ---
2
+ - - "Ascension (verwaltet von St. Helena)"
3
+ - AC
4
+ - - Andorra
5
+ - AD
6
+ - - Vereinigte Arabische Emirate
7
+ - AE
8
+ - - Afghanistan
9
+ - AF
10
+ - - Antigua und Barbuda
11
+ - AG
12
+ - - Anguilla
13
+ - AI
14
+ - - Albanien
15
+ - AL
16
+ - - Armenien
17
+ - AM
18
+ - - "Niederländische Antillen"
19
+ - AN
20
+ - - Angola
21
+ - AO
22
+ - - Antarktis
23
+ - AQ
24
+ - - Argentinien
25
+ - AR
26
+ - - Amerikanisch-Samoa
27
+ - AS
28
+ - - Österreich
29
+ - AT
30
+ - - Australien
31
+ - AU
32
+ - - Aruba
33
+ - AW
34
+ - - "Åland"
35
+ - AX
36
+ - - Aserbaidschan
37
+ - AZ
38
+ - - Bosnien und Herzegowina
39
+ - BA
40
+ - - Barbados
41
+ - BB
42
+ - - Bangladesch
43
+ - BD
44
+ - - Belgien
45
+ - BE
46
+ - - Burkina Faso
47
+ - BF
48
+ - - Bulgarien
49
+ - BG
50
+ - - Bahrain
51
+ - BH
52
+ - - Burundi
53
+ - BI
54
+ - - Benin
55
+ - BJ
56
+ - - "Saint-Barthélemy"
57
+ - BL
58
+ - - Bermuda
59
+ - BM
60
+ - - Brunei Darussalam
61
+ - BN
62
+ - - Bolivien
63
+ - BO
64
+ - - Brasilien
65
+ - BR
66
+ - - Bahamas
67
+ - BS
68
+ - - Bhutan
69
+ - BT
70
+ - - Burma (jetzt Myanmar)
71
+ - BU
72
+ - - Bouvetinsel
73
+ - BV
74
+ - - Botswana
75
+ - BW
76
+ - - "Belarus (Weißrussland)"
77
+ - BY
78
+ - - Belize
79
+ - BZ
80
+ - - Kanada
81
+ - CA
82
+ - - Kokosinseln
83
+ - CC
84
+ - - Kongo, Demokratische Republik (ehem. Zaire)
85
+ - CD
86
+ - - "Europäische Gemeinschaft"
87
+ - CE
88
+ - - Zentralafrikanische Republik
89
+ - CF
90
+ - - Republik Kongo
91
+ - CG
92
+ - - Schweiz (Confoederatio Helvetica)
93
+ - CH
94
+ - - "Côte d'Ivoire (Elfenbeinküste)"
95
+ - CI
96
+ - - Cookinseln
97
+ - CK
98
+ - - Chile
99
+ - CL
100
+ - - Kamerun
101
+ - CM
102
+ - - China, Volksrepublik
103
+ - CN
104
+ - - Kolumbien
105
+ - CO
106
+ - - "Clipperton"
107
+ - CP
108
+ - - Costa Rica
109
+ - CR
110
+ - - Serbien und Montenegro (ehemalig)
111
+ - CS
112
+ - - Tschechoslowakei (ehemalig)
113
+ - CS
114
+ - - Kuba
115
+ - CU
116
+ - - Kap Verde
117
+ - CV
118
+ - - Weihnachtsinsel
119
+ - CX
120
+ - - Zypern
121
+ - CY
122
+ - - Tschechische Republik
123
+ - CZ
124
+ - - Deutschland
125
+ - DE
126
+ - - "Diego Garcia"
127
+ - DG
128
+ - - Dschibuti
129
+ - DJ
130
+ - - "Dänemark"
131
+ - DK
132
+ - - Dominica
133
+ - DM
134
+ - - Dominikanische Republik
135
+ - DO
136
+ - - Algerien
137
+ - DZ
138
+ - - Ceuta, Melilla
139
+ - EA
140
+ - - Ecuador
141
+ - EC
142
+ - - Estland
143
+ - EE
144
+ - - "Ägypten"
145
+ - EG
146
+ - - Westsahara
147
+ - EH
148
+ - - Eritrea
149
+ - ER
150
+ - - Spanien
151
+ - ES
152
+ - - "Äthiopien"
153
+ - ET
154
+ - - "Europäische Union"
155
+ - EU
156
+ - - Finnland
157
+ - FI (SF)
158
+ - - Fidschi
159
+ - FJ
160
+ - - Falklandinseln
161
+ - FK
162
+ - - Mikronesien
163
+ - FM
164
+ - - "Färöer"
165
+ - FO
166
+ - - Frankreich
167
+ - FR
168
+ - - "Frankreich (ohne Übersee-Départements)"
169
+ - FX
170
+ - - Gabun
171
+ - GA
172
+ - - "Vereinigtes Königreich Großritannien und Nordirland"
173
+ - GB
174
+ - - Grenada
175
+ - GD
176
+ - - Georgien
177
+ - GE
178
+ - - "Französisch-Guayana"
179
+ - GF
180
+ - - Guernsey (Kanalinsel)
181
+ - GG
182
+ - - Ghana
183
+ - GH
184
+ - - Gibraltar
185
+ - GI
186
+ - - "Grönland"
187
+ - GL
188
+ - - Gambia
189
+ - GM
190
+ - - Guinea
191
+ - GN
192
+ - - Guadeloupe
193
+ - GP
194
+ - - "Äquatorialguinea"
195
+ - GQ
196
+ - - Griechenland
197
+ - GR
198
+ - - "Südgeorgien und die Südlichen Sandwichinseln"
199
+ - GS
200
+ - - Guatemala
201
+ - GT
202
+ - - Guam
203
+ - GU
204
+ - - Guinea-Bissau
205
+ - GW
206
+ - - Guyana
207
+ - GY
208
+ - - Hongkong
209
+ - HK
210
+ - - Heard und McDonaldinseln
211
+ - HM
212
+ - - Honduras
213
+ - HN
214
+ - - Kroatien
215
+ - HR
216
+ - - Haiti
217
+ - HT
218
+ - - Ungarn
219
+ - HU
220
+ - - Kanarische Inseln
221
+ - IC
222
+ - - Indonesien
223
+ - ID
224
+ - - Irland
225
+ - IE
226
+ - - Israel
227
+ - IL
228
+ - - Insel Man
229
+ - IM
230
+ - - Indien
231
+ - IN
232
+ - - Britisches Territorium im Indischen Ozean
233
+ - IO
234
+ - - Irak
235
+ - IQ
236
+ - - Iran, Islamische Republik
237
+ - IR
238
+ - - Island
239
+ - IS
240
+ - - Italien
241
+ - IT
242
+ - - Jersey (Kanalinsel)
243
+ - JE
244
+ - - Jamaika
245
+ - JM
246
+ - - Jordanien
247
+ - JO
248
+ - - Japan
249
+ - JP
250
+ - - Kenia
251
+ - KE
252
+ - - Kirgisistan
253
+ - KG
254
+ - - Kambodscha
255
+ - KH
256
+ - - Kiribati
257
+ - KI
258
+ - - Komoren
259
+ - KM
260
+ - - St. Kitts und Nevis
261
+ - KN
262
+ - - Korea, Demokratische Volksrepublik (Nordkorea)
263
+ - KP
264
+ - - "Korea, Republik (Südkorea)"
265
+ - KR
266
+ - - Kuwait
267
+ - KW
268
+ - - Kaimaninseln
269
+ - KY
270
+ - - Kasachstan
271
+ - KZ
272
+ - - Laos, Demokratische Volksrepublik
273
+ - LA
274
+ - - Libanon
275
+ - LB
276
+ - - St. Lucia
277
+ - LC
278
+ - - Liechtenstein
279
+ - LI
280
+ - - Sri Lanka
281
+ - LK
282
+ - - Liberia
283
+ - LR
284
+ - - Lesotho
285
+ - LS
286
+ - - Litauen
287
+ - LT
288
+ - - Luxemburg
289
+ - LU
290
+ - - Lettland
291
+ - LV
292
+ - - Libysch-Arabische Dschamahirija (Libyen)
293
+ - LY
294
+ - - Marokko
295
+ - MA
296
+ - - Monaco
297
+ - MC
298
+ - - Moldawien (Republik Moldau)
299
+ - MD
300
+ - - Montenegro
301
+ - ME
302
+ - - Saint-Martin (franz. Teil)
303
+ - MF
304
+ - - Madagaskar
305
+ - MG
306
+ - - Marshallinseln
307
+ - MH
308
+ - - Mazedonien, ehem. jugoslawische Republik
309
+ - MK
310
+ - - Mali
311
+ - ML
312
+ - - Myanmar (Burma)
313
+ - MM
314
+ - - Mongolei
315
+ - MN
316
+ - - Macao
317
+ - MO
318
+ - - "Nördliche Marianen"
319
+ - MP
320
+ - - Martinique
321
+ - MQ
322
+ - - Mauretanien
323
+ - MR
324
+ - - Montserrat
325
+ - MS
326
+ - - Malta
327
+ - MT
328
+ - - Mauritius
329
+ - MU
330
+ - - Malediven
331
+ - MV
332
+ - - Malawi
333
+ - MW
334
+ - - Mexiko
335
+ - MX
336
+ - - Malaysia
337
+ - MY
338
+ - - Mosambik
339
+ - MZ
340
+ - - Namibia
341
+ - NA
342
+ - - Neukaledonien
343
+ - NC
344
+ - - Niger
345
+ - NE
346
+ - - Norfolkinsel
347
+ - NF
348
+ - - Nigeria
349
+ - NG
350
+ - - Nicaragua
351
+ - NI
352
+ - - Niederlande
353
+ - NL
354
+ - - Norwegen
355
+ - NO
356
+ - - Nepal
357
+ - NP
358
+ - - Nauru
359
+ - NR
360
+ - - Neutrale Zone (Saudi-Arabien und Irak bis 1993)
361
+ - NT
362
+ - - Niue
363
+ - NU
364
+ - - Neuseeland
365
+ - NZ
366
+ - - Oman
367
+ - OM
368
+ - - Panama
369
+ - PA
370
+ - - Peru
371
+ - PE
372
+ - - "Französisch-Polynesien"
373
+ - PF
374
+ - - Papua-Neuguinea
375
+ - PG
376
+ - - Philippinen
377
+ - PH
378
+ - - Pakistan
379
+ - PK
380
+ - - Polen
381
+ - PL
382
+ - - Saint-Pierre und Miquelon
383
+ - PM
384
+ - - Pitcairninseln
385
+ - PN
386
+ - - Puerto Rico
387
+ - PR
388
+ - - "Palästinensische Autonomiegebiete"
389
+ - PS
390
+ - - Portugal
391
+ - PT
392
+ - - Palau
393
+ - PW
394
+ - - Paraguay
395
+ - PY
396
+ - - Katar
397
+ - QA
398
+ - - "Réunion"
399
+ - RE
400
+ - - "Rumänien"
401
+ - RO
402
+ - - Serbien
403
+ - RS
404
+ - - "Russische Föderation"
405
+ - RU
406
+ - - Ruanda
407
+ - RW
408
+ - - Saudi-Arabien
409
+ - SA
410
+ - - Salomonen
411
+ - SB
412
+ - - Seychellen
413
+ - SC
414
+ - - Sudan
415
+ - SD
416
+ - - Schweden
417
+ - SE
418
+ - - Singapur
419
+ - SG
420
+ - - St. Helena
421
+ - SH
422
+ - - Slowenien
423
+ - SI
424
+ - - Svalbard und Jan Mayen
425
+ - SJ
426
+ - - Slowakei
427
+ - SK
428
+ - - Sierra Leone
429
+ - SL
430
+ - - San Marino
431
+ - SM
432
+ - - Senegal
433
+ - SN
434
+ - - Somalia
435
+ - SO
436
+ - - Suriname
437
+ - SR
438
+ - - "São Tomé und Príncipe"
439
+ - ST
440
+ - - "UdSSR (jetzt: Russische Föderation)"
441
+ - SU
442
+ - - El Salvador
443
+ - SV
444
+ - - Syrien, Arabische Republik
445
+ - SY
446
+ - - Swasiland
447
+ - SZ
448
+ - - "Tristan da Cunha (verwaltet von St. Helena)"
449
+ - TA
450
+ - - Turks- und Caicosinseln
451
+ - TC
452
+ - - Tschad
453
+ - TD
454
+ - - "Französische Süd- und Antarktisgebiete"
455
+ - TF
456
+ - - Togo
457
+ - TG
458
+ - - Thailand
459
+ - TH
460
+ - - Tadschikistan
461
+ - TJ
462
+ - - Tokelau
463
+ - TK
464
+ - - Osttimor (Timor-Leste)
465
+ - TL
466
+ - - Turkmenistan
467
+ - TM
468
+ - - Tunesien
469
+ - TN
470
+ - - Tonga
471
+ - TO
472
+ - - "Türkei"
473
+ - TR
474
+ - - Trinidad und Tobago
475
+ - TT
476
+ - - Tuvalu
477
+ - TV
478
+ - - Republik China (Taiwan)
479
+ - TW
480
+ - - Tansania, Vereinigte Republik
481
+ - TZ
482
+ - - Ukraine
483
+ - UA
484
+ - - Uganda
485
+ - UG
486
+ - - United States Minor Outlying Islands
487
+ - UM
488
+ - - Vereinigte Staaten von Amerika
489
+ - US
490
+ - - Uruguay
491
+ - UY
492
+ - - Usbekistan
493
+ - UZ
494
+ - - Vatikanstadt
495
+ - VA
496
+ - - St. Vincent und die Grenadinen
497
+ - VC
498
+ - - Venezuela
499
+ - VE
500
+ - - Britische Jungferninseln
501
+ - VG
502
+ - - Amerikanische Jungferninseln
503
+ - VI
504
+ - - Vietnam
505
+ - VN
506
+ - - Vanuatu
507
+ - VU
508
+ - - Wallis und Futuna
509
+ - WF
510
+ - - Samoa
511
+ - WS
512
+ - - Jemen
513
+ - YE
514
+ - - Mayotte
515
+ - YT
516
+ - - Jugoslawien (ehemalig)
517
+ - YU
518
+ - - "Südafrika"
519
+ - ZA
520
+ - - Sambia
521
+ - ZM
522
+ - - Zaire (jetzt Demokratische Republik Kongo)
523
+ - ZR
524
+ - - Simbabwe
525
+ - ZW
File without changes
@@ -0,0 +1,39 @@
1
+ ---
2
+ - - Andalucía
3
+ - AND
4
+ - - Aragón
5
+ - ARA
6
+ - - Canarias
7
+ - CAN
8
+ - - Cantabria
9
+ - CAN
10
+ - - Castilla-La Mancha
11
+ - CLM
12
+ - - Castilla y León
13
+ - CyL
14
+ - - Cataluña
15
+ - CAT
16
+ - - Ceuta
17
+ - CEU
18
+ - - Comunidad de Madrid
19
+ - MAD
20
+ - - Comunidad Valenciana
21
+ - CVA
22
+ - - Extremadura
23
+ - EXT
24
+ - - Galicia
25
+ - GAL
26
+ - - Islas Baleares
27
+ - IB
28
+ - - La Rioja
29
+ - LRJ
30
+ - - Melilla
31
+ - MEL
32
+ - - Navarra
33
+ - NAV
34
+ - - País Vasco
35
+ - PV
36
+ - - Principado de Asturias
37
+ - AST
38
+ - - Región de Murcia
39
+ - RMU
@@ -14,14 +14,12 @@ module Carmen
14
14
  self.default_country = 'US'
15
15
  self.locale = :en
16
16
 
17
- @data_path = File.join(File.dirname(__FILE__), '../data')
18
-
19
- DEFAULT_COUNTRIES = @countries = YAML.load_file(File.join(@data_path, 'countries.yml'))
17
+ @data_path = File.join(File.dirname(__FILE__), '..', 'data')
20
18
 
21
19
  STATES = Dir[@data_path + '/states/*.yml'].map do |file_name|
22
20
  [File::basename(file_name, '.yml').upcase, YAML.load_file(file_name)]
23
21
  end
24
-
22
+
25
23
  # Raised when attempting to retrieve states for an unsupported country
26
24
  class StatesNotSupported < RuntimeError; end
27
25
 
@@ -30,52 +28,51 @@ module Carmen
30
28
 
31
29
  # Raised when attemting to switch to a locale which does not exist
32
30
  class UnavailableLocale < RuntimeError; end
33
-
34
- # Loads a localized version of the country list
35
- def self.locale=(input)
36
- localization = File.join(@data_path, "countries.#{input}.yml")
37
-
38
- raise UnavailableLocale unless File.exists?(localization)
39
-
40
- # Load localization
41
- localized_countries = YAML.load_file(localization)
31
+
32
+ # Returns a list of all countries
33
+ def self.countries(options={})
34
+ # Use specified locale or fall back to default locale
35
+ locale = options.delete(:locale) || @locale
42
36
 
43
- # Merge the defaults with the localized versions
44
- @countries = DEFAULT_COUNTRIES # Reset countries to default list
45
- positions = country_codes # for speed optimization
46
- localized_countries.each do |c|
47
- if index = country_codes.index(c[1])
48
- @countries[country_codes.index(c[1])] = c
49
- else
50
- @countries.push(c)
37
+ # Load the country list for the specified locale
38
+ @countries ||= {}
39
+ unless @countries[locale]
40
+ # Check if data in the specified locale is available
41
+ localized_data = File.join(@data_path, "countries.#{locale}.yml")
42
+ unless File.exists?(localized_data)
43
+ raise(UnavailableLocale, "Could not load countries for '#{locale}' locale")
51
44
  end
45
+
46
+ # As the data exists, load it
47
+ @countries[locale] ||= YAML.load_file(File.join(@data_path, "countries.#{locale}.yml"))
52
48
  end
53
49
 
54
- @locale = input.to_s
50
+ # Return data
51
+ @countries[locale]
55
52
  end
56
-
53
+
57
54
  # Returns the country name corresponding to the supplied country code
58
55
  # Carmen::country_name('TV') => 'Tuvalu'
59
56
  def self.country_name(country_code)
60
- search_collection(@countries, country_code, 1, 0)
57
+ search_collection(countries, country_code, 1, 0)
61
58
  end
62
59
 
63
60
  # Returns the country code corresponding to the supplied country name
64
61
  # Carmen::country_code('Canada') => 'CA'
65
62
  def self.country_code(country_name)
66
- search_collection(@countries, country_name, 0, 1)
63
+ search_collection(countries, country_name, 0, 1)
67
64
  end
68
65
 
69
66
  # Returns an array of all country codes
70
67
  # Carmen::country_codes => ['AF', 'AX', 'AL', ... ]
71
68
  def self.country_codes
72
- @countries.map {|c| c[1] }
69
+ countries.map {|c| c[1] }
73
70
  end
74
71
 
75
72
  # Returns an array of all country codes
76
73
  # Carmen::country_name => ['Afghanistan', 'Aland Islands', 'Albania', ... ]
77
74
  def self.country_names
78
- @countries.map {|c| c[0] }
75
+ countries.map {|c| c[0] }
79
76
  end
80
77
 
81
78
  # Returns the state name corresponding to the supplied state code within the specified country
@@ -3,6 +3,26 @@ require File.join(File.dirname(__FILE__), '../lib/carmen')
3
3
 
4
4
  class TestCarmen < Test::Unit::TestCase
5
5
 
6
+ def test_default_countries
7
+ assert_equal ['Aland Islands', 'AX'], Carmen.countries[1]
8
+ end
9
+
10
+ def test_localized_countries
11
+ Carmen.locale = :de
12
+ assert_equal ["Ascension (verwaltet von St. Helena)", 'AC'], Carmen.countries[0]
13
+ Carmen.locale = :en # restore default
14
+ end
15
+
16
+ def test_single_localized_countries_call
17
+ # Check that we are working with the default
18
+ assert_equal ['Aland Islands', 'AX'], Carmen.countries[1]
19
+
20
+ # Switch to a different locale for one call
21
+ assert_equal ["Ascension (verwaltet von St. Helena)", 'AC'], Carmen.countries(:locale => 'de')[0]
22
+
23
+ # Make sure that we are back in the default locale
24
+ assert_equal ['Aland Islands', 'AX'], Carmen.countries[1]
25
+ end
6
26
 
7
27
  def test_country_name
8
28
  assert_equal 'United States', Carmen.country_name('US')
@@ -11,6 +31,7 @@ class TestCarmen < Test::Unit::TestCase
11
31
  def test_localized_country_name
12
32
  Carmen.locale = :de
13
33
  assert_equal 'Deutschland', Carmen.country_name('DE')
34
+ Carmen.locale = :en # restore default
14
35
  end
15
36
 
16
37
  def test_country_code
@@ -20,6 +41,7 @@ class TestCarmen < Test::Unit::TestCase
20
41
  def test_localized_country_code
21
42
  Carmen.locale = :de
22
43
  assert_equal 'DE', Carmen.country_code('Deutschland')
44
+ Carmen.locale = :en # restore default
23
45
  end
24
46
 
25
47
  def test_country_codes
@@ -82,7 +104,7 @@ class TestCarmen < Test::Unit::TestCase
82
104
 
83
105
  def test_unsupported_locale
84
106
  assert_raises Carmen::UnavailableLocale do
85
- Carmen.locale = :latin
107
+ Carmen.countries(:locale => :latin)
86
108
  end
87
109
  end
88
110
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jim Benton
@@ -38,13 +38,15 @@ files:
38
38
  - Rakefile
39
39
  - VERSION
40
40
  - carmen.gemspec
41
- - data/countries.yml
41
+ - data/countries.de.yml
42
+ - data/countries.en.yml
42
43
  - data/states/au.yml
43
44
  - data/states/br.yml
44
45
  - data/states/ca.yml
45
46
  - data/states/cu.yml
46
47
  - data/states/de.yml
47
48
  - data/states/dk.yml
49
+ - data/states/es.yml
48
50
  - data/states/it.yml
49
51
  - data/states/mx.yml
50
52
  - data/states/ua.yml