continents 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +45 -0
- data/lib/continents.rb +1 -0
- data/lib/ravibhim/continents.rb +27 -0
- data/lib/ravibhim/data/africa.yml +57 -0
- data/lib/ravibhim/data/asia.yml +53 -0
- data/lib/ravibhim/data/australia.yml +2 -0
- data/lib/ravibhim/data/europe.yml +51 -0
- data/lib/ravibhim/data/north_america.yml +39 -0
- data/lib/ravibhim/data/south_america.yml +14 -0
- data/scripts/country_list.rb +12 -0
- data/scripts/wiki_list.txt +246 -0
- data/spec/continents_spec.rb +71 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +94 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Ravi Bhim
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= continents
|
2
|
+
|
3
|
+
Mapping from Continents to Countries and viceversa.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Ravi Bhim. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "continents"
|
8
|
+
gem.summary = %Q{Continents and Countries}
|
9
|
+
gem.description = %Q{Mapping from Continents to Countries and viceversa.}
|
10
|
+
gem.email = "ravi.bhim@yahoo.com"
|
11
|
+
gem.homepage = "http://github.com/ravibhim/continents"
|
12
|
+
gem.authors = ["Ravi Bhim"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'spec/rake/spectask'
|
22
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
+
spec.libs << 'lib' << 'spec'
|
24
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
|
33
|
+
task :spec => :check_dependencies
|
34
|
+
|
35
|
+
task :default => :spec
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "continents #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/lib/continents.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'ravibhim/continents'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Ravibhim
|
4
|
+
module Continents
|
5
|
+
CONTINENTS = ['Asia', 'Australia', 'Europe', 'Africa', 'North America', 'South America']
|
6
|
+
|
7
|
+
# Load countries from yaml files.
|
8
|
+
# and build up country to continent mapping
|
9
|
+
COUNTRY_TO_CONTINENT = {}
|
10
|
+
CONTINENTS.each do |cont|
|
11
|
+
cont_file_name = cont.downcase.gsub(' ','_')
|
12
|
+
cont_const_name = cont.upcase.gsub(' ','_')
|
13
|
+
|
14
|
+
countries = YAML.load_file(File.dirname(__FILE__) + "/data/#{cont_file_name}.yml")
|
15
|
+
countries.each do |country|
|
16
|
+
COUNTRY_TO_CONTINENT[country] = cont
|
17
|
+
end
|
18
|
+
|
19
|
+
const_set("#{cont_const_name}_COUNTRIES", countries)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def self.get_continent(country)
|
24
|
+
COUNTRY_TO_CONTINENT[country]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +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
|
@@ -0,0 +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
|
24
|
+
- Korea
|
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
|
@@ -0,0 +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
|
19
|
+
- Guernsey
|
20
|
+
- Holy See (Vatican City State)
|
21
|
+
- Hungary
|
22
|
+
- Iceland
|
23
|
+
- Ireland
|
24
|
+
- Isle of Man
|
25
|
+
- Italy
|
26
|
+
- Jersey
|
27
|
+
- Latvia
|
28
|
+
- Liechtenstein
|
29
|
+
- Lithuania
|
30
|
+
- Luxembourg
|
31
|
+
- Macedonia
|
32
|
+
- Malta
|
33
|
+
- Moldova
|
34
|
+
- Monaco
|
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
|
@@ -0,0 +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
|
30
|
+
- Saint Barthelemy
|
31
|
+
- Saint Kitts and Nevis
|
32
|
+
- Saint Lucia
|
33
|
+
- Saint Martin
|
34
|
+
- Saint Pierre and Miquelon
|
35
|
+
- Saint Vincent and the Grenadines
|
36
|
+
- Trinidad and Tobago
|
37
|
+
- Turks and Caicos Islands
|
38
|
+
- United States Virgin Islands
|
39
|
+
- United States of America
|
@@ -0,0 +1,12 @@
|
|
1
|
+
CONTINENT = 'SA'
|
2
|
+
File.open("wiki_list.txt", "r") do |infile|
|
3
|
+
while (line = infile.gets)
|
4
|
+
(cont, ignore1, ignore2, ignore3, *country_tokens) = line.split(' ')
|
5
|
+
next unless(cont == CONTINENT)
|
6
|
+
|
7
|
+
country = country_tokens.join(' ')
|
8
|
+
(simple_country, igonore) = country.split(',')
|
9
|
+
simple_country.strip!
|
10
|
+
puts "- #{simple_country}"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,246 @@
|
|
1
|
+
AS AF AFG 004 Afghanistan, Islamic Republic of
|
2
|
+
EU AX ALA 248 Aland Islands
|
3
|
+
EU AL ALB 008 Albania, Republic of
|
4
|
+
AF DZ DZA 012 Algeria, People's Democratic Republic of
|
5
|
+
OC AS ASM 016 American Samoa
|
6
|
+
EU AD AND 020 Andorra, Principality of
|
7
|
+
AF AO AGO 024 Angola, Republic of
|
8
|
+
NA AI AIA 660 Anguilla
|
9
|
+
AN AQ ATA 010 Antarctica (the territory South of 60 deg S)
|
10
|
+
NA AG ATG 028 Antigua and Barbuda
|
11
|
+
SA AR ARG 032 Argentina, Argentine Republic
|
12
|
+
AS AM ARM 051 Armenia, Republic of
|
13
|
+
NA AW ABW 533 Aruba
|
14
|
+
OC AU AUS 036 Australia, Commonwealth of
|
15
|
+
EU AT AUT 040 Austria, Republic of
|
16
|
+
AS AZ AZE 031 Azerbaijan, Republic of
|
17
|
+
NA BS BHS 044 Bahamas, Commonwealth of the
|
18
|
+
AS BH BHR 048 Bahrain, Kingdom of
|
19
|
+
AS BD BGD 050 Bangladesh, People's Republic of
|
20
|
+
NA BB BRB 052 Barbados
|
21
|
+
EU BY BLR 112 Belarus, Republic of
|
22
|
+
EU BE BEL 056 Belgium, Kingdom of
|
23
|
+
NA BZ BLZ 084 Belize
|
24
|
+
AF BJ BEN 204 Benin, Republic of
|
25
|
+
NA BM BMU 060 Bermuda
|
26
|
+
AS BT BTN 064 Bhutan, Kingdom of
|
27
|
+
SA BO BOL 068 Bolivia, Republic of
|
28
|
+
EU BA BIH 070 Bosnia and Herzegovina
|
29
|
+
AF BW BWA 072 Botswana, Republic of
|
30
|
+
AN BV BVT 074 Bouvet Island (Bouvetoya)
|
31
|
+
SA BR BRA 076 Brazil, Federative Republic of
|
32
|
+
AS IO IOT 086 British Indian Ocean Territory (Chagos Archipelago)
|
33
|
+
NA VG VGB 092 British Virgin Islands
|
34
|
+
AS BN BRN 096 Brunei Darussalam
|
35
|
+
EU BG BGR 100 Bulgaria, Republic of
|
36
|
+
AF BF BFA 854 Burkina Faso
|
37
|
+
AF BI BDI 108 Burundi, Republic of
|
38
|
+
AS KH KHM 116 Cambodia, Kingdom of
|
39
|
+
AF CM CMR 120 Cameroon, Republic of
|
40
|
+
NA CA CAN 124 Canada
|
41
|
+
AF CV CPV 132 Cape Verde, Republic of
|
42
|
+
NA KY CYM 136 Cayman Islands
|
43
|
+
AF CF CAF 140 Central African Republic
|
44
|
+
AF TD TCD 148 Chad, Republic of
|
45
|
+
SA CL CHL 152 Chile, Republic of
|
46
|
+
AS CN CHN 156 China, People's Republic of
|
47
|
+
AS CX CXR 162 Christmas Island
|
48
|
+
AS CC CCK 166 Cocos (Keeling) Islands
|
49
|
+
SA CO COL 170 Colombia, Republic of
|
50
|
+
AF KM COM 174 Comoros, Union of the
|
51
|
+
AF CD COD 180 Congo, Democratic Republic of the
|
52
|
+
AF CG COG 178 Congo, Republic of the
|
53
|
+
OC CK COK 184 Cook Islands
|
54
|
+
NA CR CRI 188 Costa Rica, Republic of
|
55
|
+
AF CI CIV 384 Cote d'Ivoire, Republic of
|
56
|
+
EU HR HRV 191 Croatia, Republic of
|
57
|
+
NA CU CUB 192 Cuba, Republic of
|
58
|
+
AS CY CYP 196 Cyprus, Republic of
|
59
|
+
EU CZ CZE 203 Czech Republic
|
60
|
+
EU DK DNK 208 Denmark, Kingdom of
|
61
|
+
AF DJ DJI 262 Djibouti, Republic of
|
62
|
+
NA DM DMA 212 Dominica, Commonwealth of
|
63
|
+
NA DO DOM 214 Dominican Republic
|
64
|
+
SA EC ECU 218 Ecuador, Republic of
|
65
|
+
AF EG EGY 818 Egypt, Arab Republic of
|
66
|
+
NA SV SLV 222 El Salvador, Republic of
|
67
|
+
AF GQ GNQ 226 Equatorial Guinea, Republic of
|
68
|
+
AF ER ERI 232 Eritrea, State of
|
69
|
+
EU EE EST 233 Estonia, Republic of
|
70
|
+
AF ET ETH 231 Ethiopia, Federal Democratic Republic of
|
71
|
+
EU FO FRO 234 Faroe Islands
|
72
|
+
SA FK FLK 238 Falkland Islands (Malvinas)
|
73
|
+
OC FJ FJI 242 Fiji, Republic of the Fiji Islands
|
74
|
+
EU FI FIN 246 Finland, Republic of
|
75
|
+
EU FR FRA 250 France, French Republic
|
76
|
+
SA GF GUF 254 French Guiana
|
77
|
+
OC PF PYF 258 French Polynesia
|
78
|
+
AN TF ATF 260 French Southern Territories
|
79
|
+
AF GA GAB 266 Gabon, Gabonese Republic
|
80
|
+
AF GM GMB 270 Gambia, Republic of the
|
81
|
+
AS GE GEO 268 Georgia
|
82
|
+
EU DE DEU 276 Germany, Federal Republic of
|
83
|
+
AF GH GHA 288 Ghana, Republic of
|
84
|
+
EU GI GIB 292 Gibraltar
|
85
|
+
EU GR GRC 300 Greece, Hellenic Republic
|
86
|
+
NA GL GRL 304 Greenland
|
87
|
+
NA GD GRD 308 Grenada
|
88
|
+
NA GP GLP 312 Guadeloupe
|
89
|
+
OC GU GUM 316 Guam
|
90
|
+
NA GT GTM 320 Guatemala, Republic of
|
91
|
+
EU GG GGY 831 Guernsey, Bailiwick of
|
92
|
+
AF GN GIN 324 Guinea, Republic of
|
93
|
+
AF GW GNB 624 Guinea-Bissau, Republic of
|
94
|
+
SA GY GUY 328 Guyana, Co-operative Republic of
|
95
|
+
NA HT HTI 332 Haiti, Republic of
|
96
|
+
AN HM HMD 334 Heard Island and McDonald Islands
|
97
|
+
EU VA VAT 336 Holy See (Vatican City State)
|
98
|
+
NA HN HND 340 Honduras, Republic of
|
99
|
+
AS HK HKG 344 Hong Kong, Special Administrative Region of China
|
100
|
+
EU HU HUN 348 Hungary, Republic of
|
101
|
+
EU IS ISL 352 Iceland, Republic of
|
102
|
+
AS IN IND 356 India, Republic of
|
103
|
+
AS ID IDN 360 Indonesia, Republic of
|
104
|
+
AS IR IRN 364 Iran, Islamic Republic of
|
105
|
+
AS IQ IRQ 368 Iraq, Republic of
|
106
|
+
EU IE IRL 372 Ireland
|
107
|
+
EU IM IMN 833 Isle of Man
|
108
|
+
AS IL ISR 376 Israel, State of
|
109
|
+
EU IT ITA 380 Italy, Italian Republic
|
110
|
+
NA JM JAM 388 Jamaica
|
111
|
+
AS JP JPN 392 Japan
|
112
|
+
EU JE JEY 832 Jersey, Bailiwick of
|
113
|
+
AS JO JOR 400 Jordan, Hashemite Kingdom of
|
114
|
+
AS KZ KAZ 398 Kazakhstan, Republic of
|
115
|
+
AF KE KEN 404 Kenya, Republic of
|
116
|
+
OC KI KIR 296 Kiribati, Republic of
|
117
|
+
AS KP PRK 408 Korea, Democratic People's Republic of
|
118
|
+
AS KR KOR 410 Korea, Republic of
|
119
|
+
AS KW KWT 414 Kuwait, State of
|
120
|
+
AS KG KGZ 417 Kyrgyz Republic
|
121
|
+
AS LA LAO 418 Lao People's Democratic Republic
|
122
|
+
EU LV LVA 428 Latvia, Republic of
|
123
|
+
AS LB LBN 422 Lebanon, Lebanese Republic
|
124
|
+
AF LS LSO 426 Lesotho, Kingdom of
|
125
|
+
AF LR LBR 430 Liberia, Republic of
|
126
|
+
AF LY LBY 434 Libyan Arab Jamahiriya
|
127
|
+
EU LI LIE 438 Liechtenstein, Principality of
|
128
|
+
EU LT LTU 440 Lithuania, Republic of
|
129
|
+
EU LU LUX 442 Luxembourg, Grand Duchy of
|
130
|
+
AS MO MAC 446 Macao, Special Administrative Region of China
|
131
|
+
EU MK MKD 807 Macedonia, Republic of
|
132
|
+
AF MG MDG 450 Madagascar, Republic of
|
133
|
+
AF MW MWI 454 Malawi, Republic of
|
134
|
+
AS MY MYS 458 Malaysia
|
135
|
+
AS MV MDV 462 Maldives, Republic of
|
136
|
+
AF ML MLI 466 Mali, Republic of
|
137
|
+
EU MT MLT 470 Malta, Republic of
|
138
|
+
OC MH MHL 584 Marshall Islands, Republic of the
|
139
|
+
NA MQ MTQ 474 Martinique
|
140
|
+
AF MR MRT 478 Mauritania, Islamic Republic of
|
141
|
+
AF MU MUS 480 Mauritius, Republic of
|
142
|
+
AF YT MYT 175 Mayotte
|
143
|
+
NA MX MEX 484 Mexico, United Mexican States
|
144
|
+
OC FM FSM 583 Micronesia, Federated States of
|
145
|
+
EU MD MDA 498 Moldova, Republic of
|
146
|
+
EU MC MCO 492 Monaco, Principality of
|
147
|
+
AS MN MNG 496 Mongolia
|
148
|
+
EU ME MNE 499 Montenegro, Republic of
|
149
|
+
NA MS MSR 500 Montserrat
|
150
|
+
AF MA MAR 504 Morocco, Kingdom of
|
151
|
+
AF MZ MOZ 508 Mozambique, Republic of
|
152
|
+
AS MM MMR 104 Myanmar, Union of
|
153
|
+
AF NA NAM 516 Namibia, Republic of
|
154
|
+
OC NR NRU 520 Nauru, Republic of
|
155
|
+
AS NP NPL 524 Nepal, State of
|
156
|
+
NA AN ANT 530 Netherlands Antilles
|
157
|
+
EU NL NLD 528 Netherlands, Kingdom of the
|
158
|
+
OC NC NCL 540 New Caledonia
|
159
|
+
OC NZ NZL 554 New Zealand
|
160
|
+
NA NI NIC 558 Nicaragua, Republic of
|
161
|
+
AF NE NER 562 Niger, Republic of
|
162
|
+
AF NG NGA 566 Nigeria, Federal Republic of
|
163
|
+
OC NU NIU 570 Niue
|
164
|
+
OC NF NFK 574 Norfolk Island
|
165
|
+
OC MP MNP 580 Northern Mariana Islands, Commonwealth of the
|
166
|
+
EU NO NOR 578 Norway, Kingdom of
|
167
|
+
AS OM OMN 512 Oman, Sultanate of
|
168
|
+
AS PK PAK 586 Pakistan, Islamic Republic of
|
169
|
+
OC PW PLW 585 Palau, Republic of
|
170
|
+
AS PS PSE 275 Palestinian Territory, Occupied
|
171
|
+
NA PA PAN 591 Panama, Republic of
|
172
|
+
OC PG PNG 598 Papua New Guinea, Independent State of
|
173
|
+
SA PY PRY 600 Paraguay, Republic of
|
174
|
+
SA PE PER 604 Peru, Republic of
|
175
|
+
AS PH PHL 608 Philippines, Republic of the
|
176
|
+
OC PN PCN 612 Pitcairn Islands
|
177
|
+
EU PL POL 616 Poland, Republic of
|
178
|
+
EU PT PRT 620 Portugal, Portuguese Republic
|
179
|
+
NA PR PRI 630 Puerto Rico, Commonwealth of
|
180
|
+
AS QA QAT 634 Qatar, State of
|
181
|
+
AF RE REU 638 Reunion
|
182
|
+
EU RO ROU 642 Romania
|
183
|
+
EU RU RUS 643 Russian Federation
|
184
|
+
AF RW RWA 646 Rwanda, Republic of
|
185
|
+
NA BL BLM 652 Saint Barthelemy
|
186
|
+
AF SH SHN 654 Saint Helena
|
187
|
+
NA KN KNA 659 Saint Kitts and Nevis, Federation of
|
188
|
+
NA LC LCA 662 Saint Lucia
|
189
|
+
NA MF MAF 663 Saint Martin
|
190
|
+
NA PM SPM 666 Saint Pierre and Miquelon
|
191
|
+
NA VC VCT 670 Saint Vincent and the Grenadines
|
192
|
+
OC WS WSM 882 Samoa, Independent State of
|
193
|
+
EU SM SMR 674 San Marino, Republic of
|
194
|
+
AF ST STP 678 Sao Tome and Principe, Democratic Republic of
|
195
|
+
AS SA SAU 682 Saudi Arabia, Kingdom of
|
196
|
+
AF SN SEN 686 Senegal, Republic of
|
197
|
+
EU RS SRB 688 Serbia, Republic of
|
198
|
+
AF SC SYC 690 Seychelles, Republic of
|
199
|
+
AF SL SLE 694 Sierra Leone, Republic of
|
200
|
+
AS SG SGP 702 Singapore, Republic of
|
201
|
+
EU SK SVK 703 Slovakia (Slovak Republic)
|
202
|
+
EU SI SVN 705 Slovenia, Republic of
|
203
|
+
OC SB SLB 090 Solomon Islands
|
204
|
+
AF SO SOM 706 Somalia, Somali Republic
|
205
|
+
AF ZA ZAF 710 South Africa, Republic of
|
206
|
+
AN GS SGS 239 South Georgia and the South Sandwich Islands
|
207
|
+
EU ES ESP 724 Spain, Kingdom of
|
208
|
+
AS LK LKA 144 Sri Lanka, Democratic Socialist Republic of
|
209
|
+
AF SD SDN 736 Sudan, Republic of
|
210
|
+
SA SR SUR 740 Suriname, Republic of
|
211
|
+
EU SJ SJM 744 Svalbard & Jan Mayen Islands
|
212
|
+
AF SZ SWZ 748 Swaziland, Kingdom of
|
213
|
+
EU SE SWE 752 Sweden, Kingdom of
|
214
|
+
EU CH CHE 756 Switzerland, Swiss Confederation
|
215
|
+
AS SY SYR 760 Syrian Arab Republic
|
216
|
+
AS TW TWN 158 Taiwan
|
217
|
+
AS TJ TJK 762 Tajikistan, Republic of
|
218
|
+
AF TZ TZA 834 Tanzania, United Republic of
|
219
|
+
AS TH THA 764 Thailand, Kingdom of
|
220
|
+
AS TL TLS 626 Timor-Leste, Democratic Republic of
|
221
|
+
AF TG TGO 768 Togo, Togolese Republic
|
222
|
+
OC TK TKL 772 Tokelau
|
223
|
+
OC TO TON 776 Tonga, Kingdom of
|
224
|
+
NA TT TTO 780 Trinidad and Tobago, Republic of
|
225
|
+
AF TN TUN 788 Tunisia, Tunisian Republic
|
226
|
+
AS TR TUR 792 Turkey, Republic of
|
227
|
+
AS TM TKM 795 Turkmenistan
|
228
|
+
NA TC TCA 796 Turks and Caicos Islands
|
229
|
+
OC TV TUV 798 Tuvalu
|
230
|
+
AF UG UGA 800 Uganda, Republic of
|
231
|
+
EU UA UKR 804 Ukraine
|
232
|
+
AS AE ARE 784 United Arab Emirates
|
233
|
+
EU GB GBR 826 United Kingdom of Great Britain & Northern Ireland
|
234
|
+
NA US USA 840 United States of America
|
235
|
+
OC UM UMI 581 United States Minor Outlying Islands
|
236
|
+
NA VI VIR 850 United States Virgin Islands
|
237
|
+
SA UY URY 858 Uruguay, Eastern Republic of
|
238
|
+
AS UZ UZB 860 Uzbekistan, Republic of
|
239
|
+
OC VU VUT 548 Vanuatu, Republic of
|
240
|
+
SA VE VEN 862 Venezuela, Bolivarian Republic of
|
241
|
+
AS VN VNM 704 Vietnam, Socialist Republic of
|
242
|
+
OC WF WLF 876 Wallis and Futuna
|
243
|
+
AF EH ESH 732 Western Sahara
|
244
|
+
AS YE YEM 887 Yemen
|
245
|
+
AF ZM ZMB 894 Zambia, Republic of
|
246
|
+
AF ZW ZWE 716 Zimbabwe, Republic of
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Continents" do
|
4
|
+
|
5
|
+
describe "CONTINENTS" do
|
6
|
+
it 'gets set to the list of continents' do
|
7
|
+
%w(Asia Australia).each do |c|
|
8
|
+
Ravibhim::Continents::CONTINENTS.should include(c)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "Asia Countries" do
|
14
|
+
['India', 'Sri Lanka'].each do |c|
|
15
|
+
it "has #{c} in Asian countries" do
|
16
|
+
Ravibhim::Continents::ASIA_COUNTRIES.should include(c)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "Africa Countries" do
|
22
|
+
['South Africa', 'Egypt'].each do |c|
|
23
|
+
it "has #{c} in Africa countries" do
|
24
|
+
Ravibhim::Continents::AFRICA_COUNTRIES.should include(c)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "Australia Countries" do
|
30
|
+
['Australia', 'New Zealand'].each do |c|
|
31
|
+
it "has #{c} in Australian countries" do
|
32
|
+
Ravibhim::Continents::AUSTRALIA_COUNTRIES.should include(c)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "Europe Countries" do
|
38
|
+
['United Kingdom', 'Germany'].each do |c|
|
39
|
+
it "has #{c} in European countries" do
|
40
|
+
Ravibhim::Continents::EUROPE_COUNTRIES.should include(c)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "North America Countries" do
|
46
|
+
['United States of America', 'Canada'].each do |c|
|
47
|
+
it "has #{c} in North America countries" do
|
48
|
+
Ravibhim::Continents::NORTH_AMERICA_COUNTRIES.should include(c)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "South America Countries" do
|
54
|
+
['Brazil', 'Argentina'].each do |c|
|
55
|
+
it "has #{c} in South America countries" do
|
56
|
+
Ravibhim::Continents::SOUTH_AMERICA_COUNTRIES.should include(c)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe :get_country do
|
62
|
+
it 'returns the continent given the country' do
|
63
|
+
Ravibhim::Continents::get_continent('India').should == 'Asia'
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'returns nil for an unrecognized country' do
|
67
|
+
Ravibhim::Continents::get_continent('My Own Country').should == nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: continents
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ravi Bhim
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-07-07 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
31
|
+
version: 1.2.9
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
description: Mapping from Continents to Countries and viceversa.
|
35
|
+
email: ravi.bhim@yahoo.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
41
|
+
- LICENSE
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- .document
|
45
|
+
- .gitignore
|
46
|
+
- LICENSE
|
47
|
+
- README.rdoc
|
48
|
+
- Rakefile
|
49
|
+
- lib/continents.rb
|
50
|
+
- lib/ravibhim/continents.rb
|
51
|
+
- lib/ravibhim/data/africa.yml
|
52
|
+
- lib/ravibhim/data/asia.yml
|
53
|
+
- lib/ravibhim/data/australia.yml
|
54
|
+
- lib/ravibhim/data/europe.yml
|
55
|
+
- lib/ravibhim/data/north_america.yml
|
56
|
+
- lib/ravibhim/data/south_america.yml
|
57
|
+
- scripts/country_list.rb
|
58
|
+
- scripts/wiki_list.txt
|
59
|
+
- spec/continents_spec.rb
|
60
|
+
- spec/spec.opts
|
61
|
+
- spec/spec_helper.rb
|
62
|
+
has_rdoc: true
|
63
|
+
homepage: http://github.com/ravibhim/continents
|
64
|
+
licenses: []
|
65
|
+
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options:
|
68
|
+
- --charset=UTF-8
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
requirements: []
|
86
|
+
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 1.3.6
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: Continents and Countries
|
92
|
+
test_files:
|
93
|
+
- spec/continents_spec.rb
|
94
|
+
- spec/spec_helper.rb
|