country_tools 0.2 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +11 -4
  3. data/lib/country_tools.rb +37 -2
  4. data/names.yml +8 -0
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dd093ad4387651ff16890f78e2076638eb39ec2
4
- data.tar.gz: 4f4f22c64d9695ca68a9f467ae6f66eb7a9866eb
3
+ metadata.gz: eb68538b70a76984bdc49f9a9bfb2bab77daee1e
4
+ data.tar.gz: b5d03f82c7682bd3d98d40668d1bd1f7c011ac81
5
5
  SHA512:
6
- metadata.gz: bf59d17e77d852abf0253320cc4344cd3df426b70555e5fe42dabb70546b1a0a78bc151d10c14141cf290100789966075c69fb894e492533de1a0eb0bbde27b1
7
- data.tar.gz: 107cd892e5a1227d403e018d42b3456837040624a843bdb3e8033350e7fc1aeb62f38d78ffccd020bea2f7d08ffbc413bbfc34f9caace7a7a9a5bf140c3129d6
6
+ metadata.gz: 67e4df0096959c23852674a4bd6db36457a116105477c87d8edc43de361b875ad5f6d3a9ef252c3bc541917f0d123a6121fc269db311d99401e1de31d5f70df5
7
+ data.tar.gz: 5d51eb9492cc9e110ee35cdcb27afc44ba3708d6fad4a792cea98353cd2ac7b6a514b0fb72f54b749973c65a5465d0dc3b5b07e98f1ddfb354a2c51ea9dda077
@@ -2,7 +2,7 @@
2
2
 
3
3
  == Installation
4
4
 
5
- gem 'country_tools', :git => 'git://github.com/aurels/country_tools.git'
5
+ gem 'country_tools'
6
6
 
7
7
  == Supported languages
8
8
 
@@ -22,12 +22,19 @@ Get the name of a country by code [i18n aware] :
22
22
 
23
23
  CountryTools.name('BE') #=> 'Belgium'
24
24
 
25
- Ask if a country is in CEE :
25
+ Ask if a country is in European Union :
26
26
 
27
- CountryTools.in_cee?('BE') #=> true
27
+ CountryTools.in_eu?('BE') #=> true
28
28
 
29
29
  Get options for a select (inside form_for) :
30
30
 
31
31
  <%= f.select :country_code, CountryTools.options_for_select %>
32
32
 
33
- Copyright (c) 2011-2019 Aurélien Malisart, released under the MIT license
33
+ == Contributors
34
+
35
+ * Aurélien Malisart — https://phonoid.com
36
+ * Michaël Hoste — https://80limit.com
37
+
38
+ == License
39
+
40
+ Copyright (c) 2011-2019 Aurélien Malisart, released under the MIT license.
@@ -4,10 +4,45 @@ module CountryTools
4
4
  @@all_countries ||= YAML.load(File.read(path))
5
5
  end
6
6
 
7
- CEE_CODES = %w[ DE AT BE BG CY DK ES EE FI FR EL HU IE IT LV LT LU MT NL PL PT GB RO SK SI SE CZ ]
7
+ # https://en.wikipedia.org/wiki/European_Union
8
+ EU_CODES = [
9
+ 'AT', # Austria
10
+ 'BE', # Belgium
11
+ 'BG', # Bulgaria
12
+ 'HR', # Croatia
13
+ 'CY', # Cyprus
14
+ 'CZ', # Czech Republic
15
+ 'DK', # Denmark
16
+ 'EE', # Estonia
17
+ 'FI', # Finland
18
+ 'FR', # France
19
+ 'DE', # Germany
20
+ 'GR', 'EL', # Greece (https://fr.wikipedia.org/wiki/Union_europ%C3%A9enne#cite_ref-79)
21
+ 'HU', # Hungary
22
+ 'IE', # Ireland
23
+ 'IT', # Italy
24
+ 'LV', # Latvia
25
+ 'LT', # Lithuania
26
+ 'LU', # Luxembourg
27
+ 'MT', # Malta
28
+ 'NL', # Netherlands
29
+ 'PL', # Poland
30
+ 'PT', # Portugal
31
+ 'RO', # Romania
32
+ 'SK', # Slovakia
33
+ 'SI', # Slovenia
34
+ 'ES', # Spain
35
+ 'SE', # Sweden
36
+ 'GB', 'UK', # United Kingdom (https://fr.wikipedia.org/wiki/Union_europ%C3%A9enne#cite_ref-81)
37
+ ]
38
+
39
+ def self.in_eu?(code)
40
+ EU_CODES.include?(code)
41
+ end
8
42
 
9
43
  def self.in_cee?(code)
10
- CEE_CODES.include?(code)
44
+ warn "[DEPRECATION] `in_cee?` is deprecated. Please use `in_eu?` instead."
45
+ in_eu?(code)
11
46
  end
12
47
 
13
48
  def self.options_for_select
data/names.yml CHANGED
@@ -270,6 +270,10 @@ GR:
270
270
  fr: Grèce
271
271
  en: Greece
272
272
  es: Grecia
273
+ EL: # https://www.quora.com/Why-is-Greeces-country-code-EL-in-the-European-Union-but-GR-everywhere-else
274
+ fr: Grèce
275
+ en: Greece
276
+ es: Grecia
273
277
  GD:
274
278
  fr: Grenade
275
279
  en: Grenada
@@ -754,6 +758,10 @@ GB:
754
758
  fr: Royaume-Uni
755
759
  en: United Kingdom
756
760
  es: Reino Unido
761
+ UK: # Though GB is the United Kingdom's ISO 3166-1 alpha-2 code, UK is exceptionally reserved for the United Kingdom on the request of the country. (https://en.wikipedia.org/wiki/ISO_3166-2:GB)
762
+ fr: Royaume-Uni
763
+ en: United Kingdom
764
+ es: Reino Unido
757
765
  US:
758
766
  fr: États-Unis
759
767
  en: United States
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: country_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aurélien Malisart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-18 00:00:00.000000000 Z
11
+ date: 2019-06-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Country tools for Rails
14
- email: aurelien.malisart@gmail.com
14
+ email: aurelien@phonoid.com
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: