continents 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/CHANGELOG +2 -0
- data/lib/ravibhim/continents.rb +13 -2
- data/lib/ravibhim/data/africa.yml +57 -57
- data/lib/ravibhim/data/asia.yml +51 -51
- data/lib/ravibhim/data/australia.yml +2 -2
- data/lib/ravibhim/data/europe.yml +48 -48
- data/lib/ravibhim/data/north_america.yml +35 -35
- data/lib/ravibhim/data/south_america.yml +14 -14
- data/spec/continents_spec.rb +10 -0
- metadata +4 -3
data/.gitignore
CHANGED
data/CHANGELOG
ADDED
data/lib/ravibhim/continents.rb
CHANGED
@@ -6,14 +6,21 @@ module Ravibhim
|
|
6
6
|
|
7
7
|
# Load countries from yaml files.
|
8
8
|
# and build up country to continent mapping
|
9
|
+
|
9
10
|
COUNTRY_TO_CONTINENT = {}
|
11
|
+
COUNTRY_TO_CODE = {}
|
10
12
|
CONTINENTS.each do |cont|
|
11
13
|
cont_file_name = cont.downcase.gsub(' ','_')
|
12
14
|
cont_const_name = cont.upcase.gsub(' ','_')
|
13
15
|
|
14
|
-
|
15
|
-
countries
|
16
|
+
country_info = YAML.load_file(File.dirname(__FILE__) + "/data/#{cont_file_name}.yml")
|
17
|
+
countries = []
|
18
|
+
|
19
|
+
country_info.each do |country_code|
|
20
|
+
country, code = country_code.split('#')
|
21
|
+
countries << country
|
16
22
|
COUNTRY_TO_CONTINENT[country] = cont
|
23
|
+
COUNTRY_TO_CODE[country] = code
|
17
24
|
end
|
18
25
|
|
19
26
|
const_set("#{cont_const_name}_COUNTRIES", countries)
|
@@ -29,5 +36,9 @@ module Ravibhim
|
|
29
36
|
cont_const_name = cont.upcase.gsub(' ','_')
|
30
37
|
const_get("#{cont_const_name}_COUNTRIES")
|
31
38
|
end
|
39
|
+
|
40
|
+
def self.get_iso_3166_1_code(country)
|
41
|
+
COUNTRY_TO_CODE[country]
|
42
|
+
end
|
32
43
|
end
|
33
44
|
end
|
@@ -1,57 +1,57 @@
|
|
1
|
-
- Algeria
|
2
|
-
- Angola
|
3
|
-
- Benin
|
4
|
-
- Botswana
|
5
|
-
- Burkina Faso
|
6
|
-
- Burundi
|
7
|
-
- Cameroon
|
8
|
-
- Cape Verde
|
9
|
-
- Central African Republic
|
10
|
-
- Chad
|
11
|
-
- Comoros
|
12
|
-
- Congo
|
13
|
-
- Congo
|
14
|
-
- Cote d'Ivoire
|
15
|
-
- Djibouti
|
16
|
-
- Egypt
|
17
|
-
- Equatorial Guinea
|
18
|
-
- Eritrea
|
19
|
-
- Ethiopia
|
20
|
-
- Gabon
|
21
|
-
- Gambia
|
22
|
-
- Ghana
|
23
|
-
- Guinea
|
24
|
-
- Guinea-Bissau
|
25
|
-
- Kenya
|
26
|
-
- Lesotho
|
27
|
-
- Liberia
|
28
|
-
- Libyan Arab Jamahiriya
|
29
|
-
- Madagascar
|
30
|
-
- Malawi
|
31
|
-
- Mali
|
32
|
-
- Mauritania
|
33
|
-
- Mauritius
|
34
|
-
- Mayotte
|
35
|
-
- Morocco
|
36
|
-
- Mozambique
|
37
|
-
- Namibia
|
38
|
-
- Niger
|
39
|
-
- Nigeria
|
40
|
-
- Reunion
|
41
|
-
- Rwanda
|
42
|
-
- Saint Helena
|
43
|
-
- Sao Tome and Principe
|
44
|
-
- Senegal
|
45
|
-
- Seychelles
|
46
|
-
- Sierra Leone
|
47
|
-
- Somalia
|
48
|
-
- South Africa
|
49
|
-
- Sudan
|
50
|
-
- Swaziland
|
51
|
-
- Tanzania
|
52
|
-
- Togo
|
53
|
-
- Tunisia
|
54
|
-
- Uganda
|
55
|
-
- Western Sahara
|
56
|
-
- Zambia
|
57
|
-
- Zimbabwe
|
1
|
+
- Algeria#DZ
|
2
|
+
- Angola#AO
|
3
|
+
- Benin#BJ
|
4
|
+
- Botswana#BW
|
5
|
+
- Burkina Faso#BF
|
6
|
+
- Burundi#BI
|
7
|
+
- Cameroon#CM
|
8
|
+
- Cape Verde#CV
|
9
|
+
- Central African Republic#CF
|
10
|
+
- Chad#TD
|
11
|
+
- Comoros#KM
|
12
|
+
- Congo#CG
|
13
|
+
- Congo Democratic Republic#CD
|
14
|
+
- Cote d'Ivoire#CI
|
15
|
+
- Djibouti#DJ
|
16
|
+
- Egypt#EG
|
17
|
+
- Equatorial Guinea#GQ
|
18
|
+
- Eritrea#ER
|
19
|
+
- Ethiopia#ET
|
20
|
+
- Gabon#GA
|
21
|
+
- Gambia#GM
|
22
|
+
- Ghana#GH
|
23
|
+
- Guinea#GN
|
24
|
+
- Guinea-Bissau#GW
|
25
|
+
- Kenya#KE
|
26
|
+
- Lesotho#LS
|
27
|
+
- Liberia#LR
|
28
|
+
- Libyan Arab Jamahiriya#LY
|
29
|
+
- Madagascar#MG
|
30
|
+
- Malawi#MW
|
31
|
+
- Mali#ML
|
32
|
+
- Mauritania#MR
|
33
|
+
- Mauritius#MU
|
34
|
+
- Mayotte#YT
|
35
|
+
- Morocco#MA
|
36
|
+
- Mozambique#MZ
|
37
|
+
- Namibia#NA
|
38
|
+
- Niger#NE
|
39
|
+
- Nigeria#NG
|
40
|
+
- Reunion#RE
|
41
|
+
- Rwanda#RW
|
42
|
+
- Saint Helena#SH
|
43
|
+
- Sao Tome and Principe#ST
|
44
|
+
- Senegal#SN
|
45
|
+
- Seychelles#SC
|
46
|
+
- Sierra Leone#SL
|
47
|
+
- Somalia#SO
|
48
|
+
- South Africa#ZA
|
49
|
+
- Sudan#SD
|
50
|
+
- Swaziland#SZ
|
51
|
+
- Tanzania#TZ
|
52
|
+
- Togo#TG
|
53
|
+
- Tunisia#TN
|
54
|
+
- Uganda#UG
|
55
|
+
- Western Sahara#EH
|
56
|
+
- Zambia#ZM
|
57
|
+
- Zimbabwe#ZW
|
data/lib/ravibhim/data/asia.yml
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
- Afghanistan
|
2
|
-
- Armenia
|
3
|
-
- Azerbaijan
|
4
|
-
- Bahrain
|
5
|
-
- Bangladesh
|
6
|
-
- Bhutan
|
7
|
-
- Brunei Darussalam
|
8
|
-
- Cambodia
|
9
|
-
- China
|
10
|
-
- Christmas Island
|
11
|
-
- Cocos (Keeling) Islands
|
12
|
-
- Cyprus
|
13
|
-
- Georgia
|
14
|
-
- Hong Kong
|
15
|
-
- India
|
16
|
-
- Indonesia
|
17
|
-
- Iran
|
18
|
-
- Iraq
|
19
|
-
- Israel
|
20
|
-
- Japan
|
21
|
-
- Jordan
|
22
|
-
- Kazakhstan
|
23
|
-
- Korea
|
1
|
+
- Afghanistan#AF
|
2
|
+
- Armenia#AM
|
3
|
+
- Azerbaijan#AZ
|
4
|
+
- Bahrain#BH
|
5
|
+
- Bangladesh#BD
|
6
|
+
- Bhutan#BT
|
7
|
+
- Brunei Darussalam#BN
|
8
|
+
- Cambodia#KH
|
9
|
+
- China#CN
|
10
|
+
- Christmas Island#CX
|
11
|
+
- Cocos (Keeling) Islands#CC
|
12
|
+
- Cyprus#CY
|
13
|
+
- Georgia#GE
|
14
|
+
- Hong Kong#HK
|
15
|
+
- India#IN
|
16
|
+
- Indonesia#ID
|
17
|
+
- Iran#IR
|
18
|
+
- Iraq#IQ
|
19
|
+
- Israel#IL
|
20
|
+
- Japan#JP
|
21
|
+
- Jordan#JO
|
22
|
+
- Kazakhstan#KZ
|
24
23
|
- Korea
|
24
|
+
- Korea#KW
|
25
25
|
- Kuwait
|
26
|
-
- Kyrgyz Republic
|
27
|
-
- Lao People's Democratic Republic
|
28
|
-
- Lebanon
|
29
|
-
- Macao
|
30
|
-
- Malaysia
|
31
|
-
- Maldives
|
32
|
-
- Mongolia
|
33
|
-
- Myanmar
|
34
|
-
- Nepal
|
35
|
-
- Oman
|
36
|
-
- Pakistan
|
37
|
-
- Palestinian Territory
|
38
|
-
- Philippines
|
39
|
-
- Qatar
|
40
|
-
- Saudi Arabia
|
41
|
-
- Singapore
|
42
|
-
- Sri Lanka
|
43
|
-
- Syrian Arab Republic
|
44
|
-
- Taiwan
|
45
|
-
- Tajikistan
|
46
|
-
- Thailand
|
47
|
-
- Timor-Leste
|
48
|
-
- Turkey
|
49
|
-
- Turkmenistan
|
50
|
-
- United Arab Emirates
|
51
|
-
- Uzbekistan
|
52
|
-
- Vietnam
|
53
|
-
- Yemen
|
26
|
+
- Kyrgyz Republic#KG
|
27
|
+
- Lao People's Democratic Republic#LA
|
28
|
+
- Lebanon#LB
|
29
|
+
- Macao#MO
|
30
|
+
- Malaysia#MY
|
31
|
+
- Maldives#MV
|
32
|
+
- Mongolia#MN
|
33
|
+
- Myanmar#MM
|
34
|
+
- Nepal#NP
|
35
|
+
- Oman#OM
|
36
|
+
- Pakistan#PK
|
37
|
+
- Palestinian Territory#PS
|
38
|
+
- Philippines#PH
|
39
|
+
- Qatar#QA
|
40
|
+
- Saudi Arabia#SA
|
41
|
+
- Singapore#SG
|
42
|
+
- Sri Lanka#LK
|
43
|
+
- Syrian Arab Republic#SY
|
44
|
+
- Taiwan#TW
|
45
|
+
- Tajikistan#TJ
|
46
|
+
- Thailand#TH
|
47
|
+
- Timor-Leste#TL
|
48
|
+
- Turkey#TR
|
49
|
+
- Turkmenistan#TM
|
50
|
+
- United Arab Emirates#AE
|
51
|
+
- Uzbekistan#UZ
|
52
|
+
- Vietnam#VN
|
53
|
+
- Yemen#YE
|
@@ -1,2 +1,2 @@
|
|
1
|
-
- Australia
|
2
|
-
- New Zealand
|
1
|
+
- Australia#AU
|
2
|
+
- New Zealand#NZ
|
@@ -1,51 +1,51 @@
|
|
1
|
-
- Aland Islands
|
2
|
-
- Albania
|
3
|
-
- Andorra
|
4
|
-
- Austria
|
5
|
-
- Belarus
|
6
|
-
- Belgium
|
7
|
-
- Bosnia and Herzegovina
|
8
|
-
- Bulgaria
|
9
|
-
- Croatia
|
10
|
-
- Czech Republic
|
11
|
-
- Denmark
|
12
|
-
- Estonia
|
13
|
-
- Faroe Islands
|
14
|
-
- Finland
|
15
|
-
- France
|
16
|
-
- Germany
|
17
|
-
- Gibraltar
|
18
|
-
- Greece
|
1
|
+
- Aland Islands#AX
|
2
|
+
- Albania#AL
|
3
|
+
- Andorra#AD
|
4
|
+
- Austria#AT
|
5
|
+
- Belarus#BY
|
6
|
+
- Belgium#BE
|
7
|
+
- Bosnia and Herzegovina#BA
|
8
|
+
- Bulgaria#BG
|
9
|
+
- Croatia#HR
|
10
|
+
- Czech Republic#CZ
|
11
|
+
- Denmark#DK
|
12
|
+
- Estonia#EE
|
13
|
+
- Faroe Islands#FO
|
14
|
+
- Finland#FI
|
15
|
+
- France#FR
|
16
|
+
- Germany#DE
|
17
|
+
- Gibraltar#GI
|
18
|
+
- Greece#GR
|
19
19
|
- Guernsey
|
20
|
-
- Holy See (Vatican City State)
|
21
|
-
- Hungary
|
22
|
-
- Iceland
|
23
|
-
- Ireland
|
24
|
-
- Isle of Man
|
25
|
-
- Italy
|
20
|
+
- Holy See (Vatican City State)#VA
|
21
|
+
- Hungary#HU
|
22
|
+
- Iceland#IS
|
23
|
+
- Ireland#IE
|
24
|
+
- Isle of Man#IM
|
25
|
+
- Italy#IT
|
26
26
|
- Jersey
|
27
|
-
- Latvia
|
28
|
-
- Liechtenstein
|
29
|
-
- Lithuania
|
30
|
-
- Luxembourg
|
31
|
-
- Macedonia
|
32
|
-
- Malta
|
33
|
-
- Moldova
|
34
|
-
- Monaco
|
27
|
+
- Latvia#LV
|
28
|
+
- Liechtenstein#LI
|
29
|
+
- Lithuania#LT
|
30
|
+
- Luxembourg#LU
|
31
|
+
- Macedonia#MK
|
32
|
+
- Malta#MT
|
33
|
+
- Moldova#MD
|
34
|
+
- Monaco#MC
|
35
35
|
- Montenegro
|
36
|
-
- Netherlands
|
37
|
-
- Norway
|
38
|
-
- Poland
|
39
|
-
- Portugal
|
40
|
-
- Romania
|
41
|
-
- Russian Federation
|
42
|
-
- San Marino
|
43
|
-
- Serbia
|
44
|
-
- Slovakia
|
45
|
-
- Slovenia
|
46
|
-
- Spain
|
47
|
-
- Svalbard & Jan Mayen Islands
|
48
|
-
- Sweden
|
49
|
-
- Switzerland
|
50
|
-
- Ukraine
|
51
|
-
- United Kingdom
|
36
|
+
- Netherlands#NL
|
37
|
+
- Norway#NO
|
38
|
+
- Poland#PL
|
39
|
+
- Portugal#PT
|
40
|
+
- Romania#RO
|
41
|
+
- Russian Federation#RU
|
42
|
+
- San Marino#SM
|
43
|
+
- Serbia#CS
|
44
|
+
- Slovakia#SK
|
45
|
+
- Slovenia#SI
|
46
|
+
- Spain#ES
|
47
|
+
- Svalbard & Jan Mayen Islands#SJ
|
48
|
+
- Sweden#SE
|
49
|
+
- Switzerland#CH
|
50
|
+
- Ukraine#UA
|
51
|
+
- United Kingdom#GB
|
@@ -1,39 +1,39 @@
|
|
1
|
-
- Anguilla
|
2
|
-
- Antigua and Barbuda
|
3
|
-
- Aruba
|
4
|
-
- Bahamas
|
5
|
-
- Barbados
|
6
|
-
- Belize
|
7
|
-
- Bermuda
|
8
|
-
- British Virgin Islands
|
9
|
-
- Canada
|
10
|
-
- Cayman Islands
|
11
|
-
- Costa Rica
|
12
|
-
- Cuba
|
13
|
-
- Dominica
|
14
|
-
- Dominican Republic
|
15
|
-
- El Salvador
|
16
|
-
- Greenland
|
17
|
-
- Grenada
|
18
|
-
- Guadeloupe
|
19
|
-
- Guatemala
|
20
|
-
- Haiti
|
21
|
-
- Honduras
|
22
|
-
- Jamaica
|
23
|
-
- Martinique
|
24
|
-
- Mexico
|
25
|
-
- Montserrat
|
26
|
-
- Netherlands Antilles
|
27
|
-
- Nicaragua
|
28
|
-
- Panama
|
29
|
-
- Puerto Rico
|
1
|
+
- Anguilla#AI
|
2
|
+
- Antigua and Barbuda#AG
|
3
|
+
- Aruba#AW
|
4
|
+
- Bahamas#BS
|
5
|
+
- Barbados#BB
|
6
|
+
- Belize#BZ
|
7
|
+
- Bermuda#BM
|
8
|
+
- British Virgin Islands#VG
|
9
|
+
- Canada#CA
|
10
|
+
- Cayman Islands#KY
|
11
|
+
- Costa Rica#CR
|
12
|
+
- Cuba#CU
|
13
|
+
- Dominica#DM
|
14
|
+
- Dominican Republic#DO
|
15
|
+
- El Salvador#SV
|
16
|
+
- Greenland#GL
|
17
|
+
- Grenada#GD
|
18
|
+
- Guadeloupe#GP
|
19
|
+
- Guatemala#GT
|
20
|
+
- Haiti#HT
|
21
|
+
- Honduras#HN
|
22
|
+
- Jamaica#JM
|
23
|
+
- Martinique#MQ
|
24
|
+
- Mexico#MX
|
25
|
+
- Montserrat#MS
|
26
|
+
- Netherlands Antilles#AN
|
27
|
+
- Nicaragua#NI
|
28
|
+
- Panama#PA
|
29
|
+
- Puerto Rico#PR
|
30
30
|
- Saint Barthelemy
|
31
|
-
- Saint Kitts and Nevis
|
32
|
-
- Saint Lucia
|
31
|
+
- Saint Kitts and Nevis#KN
|
32
|
+
- Saint Lucia#LC
|
33
33
|
- Saint Martin
|
34
34
|
- Saint Pierre and Miquelon
|
35
|
-
- Saint Vincent and the Grenadines
|
36
|
-
- Trinidad and Tobago
|
37
|
-
- Turks and Caicos Islands
|
35
|
+
- Saint Vincent and the Grenadines#VC
|
36
|
+
- Trinidad and Tobago#TT
|
37
|
+
- Turks and Caicos Islands#TC
|
38
38
|
- United States Virgin Islands
|
39
|
-
- United States of America
|
39
|
+
- United States of America#US
|
@@ -1,14 +1,14 @@
|
|
1
|
-
- Argentina
|
2
|
-
- Bolivia
|
3
|
-
- Brazil
|
4
|
-
- Chile
|
5
|
-
- Colombia
|
6
|
-
- Ecuador
|
7
|
-
- Falkland Islands
|
8
|
-
- French Guiana
|
9
|
-
- Guyana
|
10
|
-
- Paraguay
|
11
|
-
- Peru
|
12
|
-
- Suriname
|
13
|
-
- Uruguay
|
14
|
-
- Venezuela
|
1
|
+
- Argentina#AM
|
2
|
+
- Bolivia#BO
|
3
|
+
- Brazil#BR
|
4
|
+
- Chile#CL
|
5
|
+
- Colombia#CO
|
6
|
+
- Ecuador#EC
|
7
|
+
- Falkland Islands#FK
|
8
|
+
- French Guiana#GF
|
9
|
+
- Guyana#GY
|
10
|
+
- Paraguay#PY
|
11
|
+
- Peru#PE
|
12
|
+
- Suriname#SR
|
13
|
+
- Uruguay#UY
|
14
|
+
- Venezuela#VE
|
data/spec/continents_spec.rb
CHANGED
@@ -86,4 +86,14 @@ describe "Continents" do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
describe :get_iso_3166_1_code do
|
90
|
+
it 'returns the code of the country if present' do
|
91
|
+
Ravibhim::Continents::get_iso_3166_1_code('Afghanistan').should == 'AF'
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'returns an empty string if the code is not present' do
|
95
|
+
Ravibhim::Continents::get_iso_3166_1_code('Kuwait').should be_nil
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
89
99
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ravi Bhim
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-27 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +43,7 @@ extra_rdoc_files:
|
|
43
43
|
files:
|
44
44
|
- .document
|
45
45
|
- .gitignore
|
46
|
+
- CHANGELOG
|
46
47
|
- LICENSE
|
47
48
|
- README.rdoc
|
48
49
|
- Rakefile
|