spine-countries 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +12 -0
- data/README.md +25 -0
- data/Rakefile +1 -0
- data/lib/spine/countries.rb +258 -0
- data/lib/spine/countries/country.rb +22 -0
- data/lib/spine/countries/registry.rb +29 -0
- data/lib/spine/countries/version.rb +5 -0
- data/spine-countries.gemspec +24 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57d90108368105acf024a87dc0203703f11ae71f
|
4
|
+
data.tar.gz: d3c032b9a08eefbe4e41f13283ad87edfff61059
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 030ae8356e669e4da8236013c445298198592aa15a955de831ede9fccab7c2c31cc42c0e63f06d6a7841d0944185c8d5290b912df41901dc635ab34b1941439e
|
7
|
+
data.tar.gz: b43157cfa8ad3bdb837b66b3195195102e19bb42fac99fa05ebc2eb424544b589fcc0f0de4dbc1eb8fa8cce3e6931c600a09abd703c8a051cdc11afed3e661db
|
data/.gitignore
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/bin/
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
# Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
spine-countries (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.5)
|
10
|
+
rake (10.4.2)
|
11
|
+
rspec (3.2.0)
|
12
|
+
rspec-core (~> 3.2.0)
|
13
|
+
rspec-expectations (~> 3.2.0)
|
14
|
+
rspec-mocks (~> 3.2.0)
|
15
|
+
rspec-core (3.2.3)
|
16
|
+
rspec-support (~> 3.2.0)
|
17
|
+
rspec-expectations (3.2.1)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.2.0)
|
20
|
+
rspec-mocks (3.2.1)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.2.0)
|
23
|
+
rspec-support (3.2.2)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.7)
|
30
|
+
rake (~> 10.0)
|
31
|
+
rspec (~> 3.2)
|
32
|
+
spine-countries!
|
data/LICENSE
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Copyright (c) 2015, TOGGL LLC
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
+
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
9
|
+
|
10
|
+
3. Neither the name of the TOGGL LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
11
|
+
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Spine::Countries
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/spine-countries.svg)](http://badge.fury.io/rb/spine-countries)
|
4
|
+
[![Dependency Status](https://gemnasium.com/rspine/countries.svg)](https://gemnasium.com/rspine/countries)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/rspine/countries/badges/gpa.svg)](https://codeclimate.com/github/rspine/countries)
|
6
|
+
|
7
|
+
Provides ISO-3166 countries list.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
To install it, add the gem to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'spine-countries'
|
15
|
+
```
|
16
|
+
|
17
|
+
Then run `bundle`. If you're not using Bundler, just `gem install spine-countries`.
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
country = Spine::Countries.find('US')
|
23
|
+
country.name
|
24
|
+
# => 'United States'
|
25
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,258 @@
|
|
1
|
+
module Spine
|
2
|
+
module Countries
|
3
|
+
autoload :Country, 'spine/countries/country'
|
4
|
+
autoload :Registry, 'spine/countries/registry'
|
5
|
+
|
6
|
+
extend Registry
|
7
|
+
|
8
|
+
define 'AD', name: 'Andorra'
|
9
|
+
define 'AE', name: 'United Arab Emirates'
|
10
|
+
define 'AF', name: 'Afganistan'
|
11
|
+
define 'AG', name: 'Antigua and Barbuda'
|
12
|
+
define 'AI', name: 'Anguilla'
|
13
|
+
define 'AL', name: 'Albania'
|
14
|
+
define 'AM', name: 'Armenia'
|
15
|
+
define 'AO', name: 'Angola'
|
16
|
+
define 'AQ', name: 'Antarctica'
|
17
|
+
define 'AR', name: 'Argentina'
|
18
|
+
define 'AS', name: 'American Samoa'
|
19
|
+
define 'AT', name: 'Austria'
|
20
|
+
define 'AU', name: 'Australia'
|
21
|
+
define 'AW', name: 'Aruba'
|
22
|
+
define 'AX', name: 'Åland Islands'
|
23
|
+
define 'AZ', name: 'Azerbaijan'
|
24
|
+
define 'BA', name: 'Bosnia and Herzegovina'
|
25
|
+
define 'BB', name: 'Barbados'
|
26
|
+
define 'BD', name: 'Bangladesh'
|
27
|
+
define 'BE', name: 'Belgium'
|
28
|
+
define 'BF', name: 'Burkina Faso'
|
29
|
+
define 'BG', name: 'Bulgaria'
|
30
|
+
define 'BH', name: 'Bahrain'
|
31
|
+
define 'BI', name: 'Burundi'
|
32
|
+
define 'BJ', name: 'Benin'
|
33
|
+
define 'BL', name: 'Saint Barthélemy'
|
34
|
+
define 'BM', name: 'Bermuda'
|
35
|
+
define 'BN', name: 'Brunei Darussalam'
|
36
|
+
define 'BO', name: 'Bolivia, Plurinational State of'
|
37
|
+
define 'BQ', name: 'Bonaire, Sint Eustatius and Saba'
|
38
|
+
define 'BR', name: 'Brazil'
|
39
|
+
define 'BS', name: 'Bahamas'
|
40
|
+
define 'BT', name: 'Bhutan'
|
41
|
+
define 'BV', name: 'Bouvet Island'
|
42
|
+
define 'BW', name: 'Botswana'
|
43
|
+
define 'BY', name: 'Belarus'
|
44
|
+
define 'BZ', name: 'Belize'
|
45
|
+
define 'CA', name: 'Canada'
|
46
|
+
define 'CC', name: 'Cocos (Keeling) Islands'
|
47
|
+
define 'CD', name: 'Congo, the Democratic Republic of the'
|
48
|
+
define 'CF', name: 'Central African Republic'
|
49
|
+
define 'CG', name: 'Congo'
|
50
|
+
define 'CH', name: 'Switzerland'
|
51
|
+
define 'CI', name: "Côte d'Ivoire"
|
52
|
+
define 'CK', name: 'Cook Islands'
|
53
|
+
define 'CL', name: 'Chile'
|
54
|
+
define 'CM', name: 'Cameroon'
|
55
|
+
define 'CN', name: 'China'
|
56
|
+
define 'CO', name: 'Colombia'
|
57
|
+
define 'CR', name: 'Costa Rica'
|
58
|
+
define 'CU', name: 'Cuba'
|
59
|
+
define 'CV', name: 'Cabo Verde'
|
60
|
+
define 'CW', name: 'Curaçao'
|
61
|
+
define 'CX', name: 'Christmas Island'
|
62
|
+
define 'CY', name: 'Cyprus'
|
63
|
+
define 'CZ', name: 'Czech Republic'
|
64
|
+
define 'DE', name: 'Germany'
|
65
|
+
define 'DJ', name: 'Djibouti'
|
66
|
+
define 'DK', name: 'Denmark'
|
67
|
+
define 'DM', name: 'Dominica'
|
68
|
+
define 'DO', name: 'Dominican Republic'
|
69
|
+
define 'DZ', name: 'Algeria'
|
70
|
+
define 'EC', name: 'Ecuador'
|
71
|
+
define 'EE', name: 'Estonia'
|
72
|
+
define 'EG', name: 'Egypt'
|
73
|
+
define 'EH', name: 'Western Sahara'
|
74
|
+
define 'ER', name: 'Eritrea'
|
75
|
+
define 'ES', name: 'Spain'
|
76
|
+
define 'ET', name: 'Ethiopia'
|
77
|
+
define 'FI', name: 'Finland'
|
78
|
+
define 'FJ', name: 'Fiji'
|
79
|
+
define 'FK', name: 'Falkland Islands (Malvinas)'
|
80
|
+
define 'FM', name: 'Micronesia, Federated States of'
|
81
|
+
define 'FO', name: 'Faroe Islands'
|
82
|
+
define 'FR', name: 'France'
|
83
|
+
define 'GA', name: 'Gabon'
|
84
|
+
define 'GB', name: 'United Kingdom'
|
85
|
+
define 'GD', name: 'Grenada'
|
86
|
+
define 'GE', name: 'Georgia'
|
87
|
+
define 'GF', name: 'French Guiana'
|
88
|
+
define 'GG', name: 'Guernsey'
|
89
|
+
define 'GH', name: 'Ghana'
|
90
|
+
define 'GI', name: 'Gibraltar'
|
91
|
+
define 'GL', name: 'Greenland'
|
92
|
+
define 'GM', name: 'Gambia'
|
93
|
+
define 'GN', name: 'Guinea'
|
94
|
+
define 'GP', name: 'Guadeloupe'
|
95
|
+
define 'GQ', name: 'Equatorial Guinea'
|
96
|
+
define 'GR', name: 'Greece'
|
97
|
+
define 'GS', name: 'South Georgia and the South Sandwich Islands'
|
98
|
+
define 'GT', name: 'Guatemala'
|
99
|
+
define 'GU', name: 'Guam'
|
100
|
+
define 'GW', name: 'Guinea-Bissau'
|
101
|
+
define 'GY', name: 'Guyana'
|
102
|
+
define 'HK', name: 'Hong Kong'
|
103
|
+
define 'HM', name: 'Heard Island and McDonald Islands'
|
104
|
+
define 'HN', name: 'Honduras'
|
105
|
+
define 'HR', name: 'Croatia'
|
106
|
+
define 'HT', name: 'Haiti'
|
107
|
+
define 'HU', name: 'Hungary'
|
108
|
+
define 'ID', name: 'Indonesia'
|
109
|
+
define 'IE', name: 'Ireland'
|
110
|
+
define 'IL', name: 'Israel'
|
111
|
+
define 'IM', name: 'Isle of Man'
|
112
|
+
define 'IN', name: 'India'
|
113
|
+
define 'IO', name: 'British Indian Ocean Territory'
|
114
|
+
define 'IQ', name: 'Iraq'
|
115
|
+
define 'IR', name: 'Iran, Islamic Republic of'
|
116
|
+
define 'IS', name: 'Iceland'
|
117
|
+
define 'IT', name: 'Italy'
|
118
|
+
define 'JE', name: 'Jersey'
|
119
|
+
define 'JM', name: 'Jamaica'
|
120
|
+
define 'JO', name: 'Jordan'
|
121
|
+
define 'JP', name: 'Japan'
|
122
|
+
define 'KE', name: 'Kenya'
|
123
|
+
define 'KG', name: 'Kyrgyzstan'
|
124
|
+
define 'KH', name: 'Cambodia'
|
125
|
+
define 'KI', name: 'Kiribati'
|
126
|
+
define 'KM', name: 'Comoros'
|
127
|
+
define 'KN', name: 'Saint Kitts and Nevis'
|
128
|
+
define 'KP', name: "Korea, Democratic People's Republic of"
|
129
|
+
define 'KR', name: 'Korea, Republic of'
|
130
|
+
define 'KW', name: 'Kuwait'
|
131
|
+
define 'KY', name: 'Cayman Islands'
|
132
|
+
define 'KZ', name: 'Kazakhstan'
|
133
|
+
define 'LA', name: "Lao People's Democratic Republic"
|
134
|
+
define 'LB', name: 'Lebanon'
|
135
|
+
define 'LC', name: 'Saint Lucia'
|
136
|
+
define 'LI', name: 'Liechtenstein'
|
137
|
+
define 'LK', name: 'Sri Lanka'
|
138
|
+
define 'LR', name: 'Liberia'
|
139
|
+
define 'LS', name: 'Lesotho'
|
140
|
+
define 'LT', name: 'Lithuania'
|
141
|
+
define 'LU', name: 'Luxembourg'
|
142
|
+
define 'LV', name: 'Latvia'
|
143
|
+
define 'LY', name: 'Libya'
|
144
|
+
define 'MA', name: 'Morocco'
|
145
|
+
define 'MC', name: 'Monaco'
|
146
|
+
define 'MD', name: 'Moldova, Republic of'
|
147
|
+
define 'ME', name: 'Montenegro'
|
148
|
+
define 'MF', name: 'Saint Martin (French part)'
|
149
|
+
define 'MG', name: 'Madagascar'
|
150
|
+
define 'MH', name: 'Marshall Islands'
|
151
|
+
define 'MK', name: 'Macedonia, the former Yugoslav Republic of'
|
152
|
+
define 'ML', name: 'Mali'
|
153
|
+
define 'MM', name: 'Myanmar'
|
154
|
+
define 'MN', name: 'Mongolia'
|
155
|
+
define 'MO', name: 'Macao'
|
156
|
+
define 'MP', name: 'Northern Mariana Islands'
|
157
|
+
define 'MQ', name: 'Martinique'
|
158
|
+
define 'MR', name: 'Mauritania'
|
159
|
+
define 'MS', name: 'Montserrat'
|
160
|
+
define 'MT', name: 'Malta'
|
161
|
+
define 'MU', name: 'Mauritius'
|
162
|
+
define 'MV', name: 'Maldives'
|
163
|
+
define 'MW', name: 'Malawi'
|
164
|
+
define 'MX', name: 'Mexico'
|
165
|
+
define 'MY', name: 'Malaysia'
|
166
|
+
define 'MZ', name: 'Mozambique'
|
167
|
+
define 'NA', name: 'Namibia'
|
168
|
+
define 'NC', name: 'New Caledonia'
|
169
|
+
define 'NE', name: 'Niger'
|
170
|
+
define 'NF', name: 'Norfolk Island'
|
171
|
+
define 'NG', name: 'Nigeria'
|
172
|
+
define 'NI', name: 'Nicaragua'
|
173
|
+
define 'NL', name: 'Netherlands'
|
174
|
+
define 'NO', name: 'Norway'
|
175
|
+
define 'NP', name: 'Nepal'
|
176
|
+
define 'NR', name: 'Nauru'
|
177
|
+
define 'NU', name: 'Niue'
|
178
|
+
define 'NZ', name: 'New Zealand'
|
179
|
+
define 'OM', name: 'Oman'
|
180
|
+
define 'PA', name: 'Panama'
|
181
|
+
define 'PE', name: 'Peru'
|
182
|
+
define 'PF', name: 'French Polynesia'
|
183
|
+
define 'PG', name: 'Papua New Guinea'
|
184
|
+
define 'PH', name: 'Philippines'
|
185
|
+
define 'PK', name: 'Pakistan'
|
186
|
+
define 'PL', name: 'Poland'
|
187
|
+
define 'PM', name: 'Saint Pierre and Miquelon'
|
188
|
+
define 'PN', name: 'Pitcairn'
|
189
|
+
define 'PR', name: 'Puerto Rico'
|
190
|
+
define 'PS', name: 'Palestine, State of'
|
191
|
+
define 'PT', name: 'Portugal'
|
192
|
+
define 'PW', name: 'Palau'
|
193
|
+
define 'PY', name: 'Paraguay'
|
194
|
+
define 'QA', name: 'Qatar'
|
195
|
+
define 'RE', name: 'Réunion'
|
196
|
+
define 'RO', name: 'Romania'
|
197
|
+
define 'RS', name: 'Serbia'
|
198
|
+
define 'RU', name: 'Russian Federation'
|
199
|
+
define 'RW', name: 'Rwanda'
|
200
|
+
define 'SA', name: 'Saudi Arabia'
|
201
|
+
define 'SB', name: 'Solomon Islands'
|
202
|
+
define 'SC', name: 'Seychelles'
|
203
|
+
define 'SD', name: 'Sudan'
|
204
|
+
define 'SE', name: 'Sweden'
|
205
|
+
define 'SG', name: 'Singapore'
|
206
|
+
define 'SH', name: 'Saint Helena, Ascension and Tristan da Cunha'
|
207
|
+
define 'SI', name: 'Slovenia'
|
208
|
+
define 'SJ', name: 'Svalbard and Jan Mayen'
|
209
|
+
define 'SK', name: 'Slovakia'
|
210
|
+
define 'SL', name: 'Sierra Leone'
|
211
|
+
define 'SM', name: 'San Marino'
|
212
|
+
define 'SN', name: 'Senegal'
|
213
|
+
define 'SO', name: 'Somalia'
|
214
|
+
define 'SR', name: 'Suriname'
|
215
|
+
define 'SS', name: 'South Sudan'
|
216
|
+
define 'ST', name: 'Sao Tome and Principe'
|
217
|
+
define 'SV', name: 'El Salvador'
|
218
|
+
define 'SX', name: 'Sint Maarten (Dutch part)'
|
219
|
+
define 'SY', name: 'Syrian Arab Republic'
|
220
|
+
define 'SZ', name: 'Swaziland'
|
221
|
+
define 'TC', name: 'Turks and Caicos Islands'
|
222
|
+
define 'TD', name: 'Chad'
|
223
|
+
define 'TF', name: 'French Southern Territories'
|
224
|
+
define 'TG', name: 'Togo'
|
225
|
+
define 'TH', name: 'Thailand'
|
226
|
+
define 'TJ', name: 'Tajikistan'
|
227
|
+
define 'TK', name: 'Tokelau'
|
228
|
+
define 'TL', name: 'Timor-Leste'
|
229
|
+
define 'TM', name: 'Turkmenistan'
|
230
|
+
define 'TN', name: 'Tunisia'
|
231
|
+
define 'TO', name: 'Tonga'
|
232
|
+
define 'TR', name: 'Turkey'
|
233
|
+
define 'TT', name: 'Trinidad and Tobago'
|
234
|
+
define 'TV', name: 'Tuvalu'
|
235
|
+
define 'TW', name: 'Taiwan, Province of China'
|
236
|
+
define 'TZ', name: 'Tanzania, United Republic of'
|
237
|
+
define 'UA', name: 'Ukraine'
|
238
|
+
define 'UG', name: 'Uganda'
|
239
|
+
define 'UM', name: 'United States Minor Outlying Islands'
|
240
|
+
define 'US', name: 'United States'
|
241
|
+
define 'UY', name: 'Uruguay'
|
242
|
+
define 'UZ', name: 'Uzbekistan'
|
243
|
+
define 'VA', name: 'Holy See (Vatican City State)'
|
244
|
+
define 'VC', name: 'Saint Vincent and the Grenadines'
|
245
|
+
define 'VE', name: 'Venezuela, Bolivarian Republic of'
|
246
|
+
define 'VG', name: 'Virgin Islands, British'
|
247
|
+
define 'VI', name: 'Virgin Islands, U.S.'
|
248
|
+
define 'VN', name: 'Viet Nam'
|
249
|
+
define 'VU', name: 'Vanuatu'
|
250
|
+
define 'WF', name: 'Wallis and Futuna'
|
251
|
+
define 'WS', name: 'Samoa'
|
252
|
+
define 'YE', name: 'Yemen'
|
253
|
+
define 'YT', name: 'Mayotte'
|
254
|
+
define 'ZA', name: 'South Africa'
|
255
|
+
define 'ZM', name: 'Zambia'
|
256
|
+
define 'ZW', name: 'Zimbabwe'
|
257
|
+
end
|
258
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Spine
|
2
|
+
module Countries
|
3
|
+
class Country
|
4
|
+
attr_reader :code, :name
|
5
|
+
|
6
|
+
def initialize(code, name = nil)
|
7
|
+
@code = code
|
8
|
+
@name = name
|
9
|
+
end
|
10
|
+
|
11
|
+
def ==(other)
|
12
|
+
!other.nil? && code == other.code
|
13
|
+
end
|
14
|
+
|
15
|
+
alias :eql? :==
|
16
|
+
|
17
|
+
def hash
|
18
|
+
code.hash
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Spine
|
2
|
+
module Countries
|
3
|
+
module Registry
|
4
|
+
def find(code)
|
5
|
+
countries.fetch((code || '').upcase)
|
6
|
+
end
|
7
|
+
|
8
|
+
def all
|
9
|
+
countries.values
|
10
|
+
end
|
11
|
+
|
12
|
+
def codes
|
13
|
+
countries.keys
|
14
|
+
end
|
15
|
+
|
16
|
+
def names
|
17
|
+
countries.map { |_, country| country.name }
|
18
|
+
end
|
19
|
+
|
20
|
+
def countries
|
21
|
+
@countries ||= {}
|
22
|
+
end
|
23
|
+
|
24
|
+
def define(code, options = {})
|
25
|
+
countries[code] = Country.new(code, options[:name])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spine/countries/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "spine-countries"
|
8
|
+
spec.version = Spine::Countries::VERSION
|
9
|
+
spec.authors = ["TOGGL LLC"]
|
10
|
+
spec.email = ["support@toggl.com"]
|
11
|
+
spec.summary = 'List of countries'
|
12
|
+
spec.description = ''
|
13
|
+
spec.homepage = 'https://github.com/rspine/countries'
|
14
|
+
spec.license = 'BSD-3-Clause'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', "~> 1.7"
|
22
|
+
spec.add_development_dependency 'rake', "~> 10.0"
|
23
|
+
spec.add_development_dependency 'rspec', "~> 3.2"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spine-countries
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- TOGGL LLC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- support@toggl.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- Gemfile.lock
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/spine/countries.rb
|
69
|
+
- lib/spine/countries/country.rb
|
70
|
+
- lib/spine/countries/registry.rb
|
71
|
+
- lib/spine/countries/version.rb
|
72
|
+
- spine-countries.gemspec
|
73
|
+
homepage: https://github.com/rspine/countries
|
74
|
+
licenses:
|
75
|
+
- BSD-3-Clause
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: List of countries
|
97
|
+
test_files: []
|