nationality 1.0.3 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +35 -14
- data/README.md +21 -2
- data/lib/nationality.rb +15 -14
- data/lib/nationality/version.rb +1 -1
- data/lib/nationality/yml/nationality_expanded_spelling.yml +499 -0
- data/nationality.gemspec +16 -14
- data/spec/nationality_spec.rb +34 -16
- metadata +76 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 45c8d8b6aec82ab8a5bb869467bd85a482e8737f7f97e65001dea8e78d1714e6
|
4
|
+
data.tar.gz: 9940f368de263339563834ece117c3012a181cf05e97b4f2adca8d089201eeb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82e5144fece39e1997287d76fcc8ae67699152ff94c0955c0066b30b96435416e90aaca148772b32b7788af0645ddd67590f2b6e6c078c77fdad6f4d180f15ce
|
7
|
+
data.tar.gz: f1ed85e52371e9edb339ffda95505ef5d96a036e72651ad9a18dd1f85613f14c6de313406befb5da6ac190c34a5704516537c5cb5f85a893c4e5cd5d3c0d3e27
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,50 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nationality (1.0.
|
4
|
+
nationality (1.0.6)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
byebug (11.0.1)
|
10
|
+
coderay (1.1.2)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
method_source (0.9.2)
|
13
|
+
pry (0.12.2)
|
14
|
+
coderay (~> 1.1.0)
|
15
|
+
method_source (~> 0.9.0)
|
16
|
+
pry-byebug (3.7.0)
|
17
|
+
byebug (~> 11.0)
|
18
|
+
pry (~> 0.10)
|
19
|
+
pry-doc (1.0.0)
|
20
|
+
pry (~> 0.11)
|
21
|
+
yard (~> 0.9.11)
|
22
|
+
rake (12.3.1)
|
23
|
+
rspec (3.8.0)
|
24
|
+
rspec-core (~> 3.8.0)
|
25
|
+
rspec-expectations (~> 3.8.0)
|
26
|
+
rspec-mocks (~> 3.8.0)
|
27
|
+
rspec-core (3.8.0)
|
28
|
+
rspec-support (~> 3.8.0)
|
29
|
+
rspec-expectations (3.8.1)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.8.0)
|
32
|
+
rspec-mocks (3.8.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.8.0)
|
35
|
+
rspec-support (3.8.0)
|
36
|
+
yard (0.9.22)
|
19
37
|
|
20
38
|
PLATFORMS
|
21
39
|
ruby
|
22
40
|
|
23
41
|
DEPENDENCIES
|
24
42
|
nationality!
|
25
|
-
|
26
|
-
|
43
|
+
pry (~> 0.12.2, >= 0.12.2)
|
44
|
+
pry-byebug (~> 3.7.0, >= 3.7.0)
|
45
|
+
pry-doc (~> 1.0.0, >= 1.0.0)
|
46
|
+
rake (~> 12.3.1, >= 12.3.1)
|
47
|
+
rspec (~> 3.8.0, >= 3.8.0)
|
27
48
|
|
28
49
|
BUNDLED WITH
|
29
|
-
1.
|
50
|
+
1.16.4
|
data/README.md
CHANGED
@@ -11,7 +11,12 @@ Data in this gem was taken from Github GIST and the following repos:
|
|
11
11
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
|
-
gem 'nationality', '~> 1.0.
|
14
|
+
gem 'nationality', '~> 1.0.7'
|
15
|
+
|
16
|
+
|
17
|
+
or
|
18
|
+
|
19
|
+
gem 'nationality', '~> 1.0.7', git: 'https://github.com/JomaMinoza/nationality'
|
15
20
|
|
16
21
|
And then execute:
|
17
22
|
|
@@ -26,8 +31,11 @@ Or install it yourself as:
|
|
26
31
|
This gem provides the following constant arrays:
|
27
32
|
|
28
33
|
* `Nationality::NATIONALITY`
|
34
|
+
```ruby
|
35
|
+
Nationality::Nationality.default_option("filipino")
|
36
|
+
```
|
29
37
|
|
30
|
-
##
|
38
|
+
## Pre selected option for Select Helper
|
31
39
|
|
32
40
|
Customize `options_for_select` with default nationality for your Rails application.
|
33
41
|
|
@@ -35,6 +43,13 @@ Customize `options_for_select` with default nationality for your Rails applicati
|
|
35
43
|
= f.select :nationality, options_for_select(Nationality::Nationality.default_option("filipino"), :selected => f.object.nationality), {include_blank: "What's your nationality?"}, {:class => 'form-control' }
|
36
44
|
```
|
37
45
|
|
46
|
+
## Includes larger list of nationalities and some alternative spellings + 300 more options
|
47
|
+
* `Nationality::NATIONALITY_EXPANDED_SPELLING` - list of possible alternative spellings, plus additional nationalities, extracted from some Wikipedia parsing. Suggested use - various text processing.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
Nationality::Nationality.default_option("Belorussian", :expanded)
|
51
|
+
```
|
52
|
+
|
38
53
|
## Contributing
|
39
54
|
|
40
55
|
1. Fork it
|
@@ -42,3 +57,7 @@ Customize `options_for_select` with default nationality for your Rails applicati
|
|
42
57
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
58
|
4. Push to the branch (`git push origin my-new-feature`)
|
44
59
|
5. Create new Pull Request
|
60
|
+
|
61
|
+
## License
|
62
|
+
|
63
|
+
[MIT](LICENSE.txt)
|
data/lib/nationality.rb
CHANGED
@@ -1,27 +1,29 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'nationality/version'
|
2
|
+
require 'yaml'
|
3
3
|
|
4
4
|
module Nationality
|
5
|
-
|
6
|
-
YML_NATIONALITY = YAML.load_file(File.join(File.dirname(__FILE__),"nationality", "yml", "nationality.yml"))
|
7
|
-
|
5
|
+
YML_NATIONALITY = YAML.load_file(File.join(File.dirname(__FILE__), 'nationality', 'yml', 'nationality.yml'))
|
8
6
|
NATIONALITY = YML_NATIONALITY.map { |_, v| v }.flatten.compact.sort
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
YML_NATIONALITY_EXPANDED_SPELLING = YAML.load_file(File.join(File.dirname(__FILE__),
|
9
|
+
'nationality',
|
10
|
+
'yml',
|
11
|
+
'nationality_expanded_spelling.yml'))
|
12
|
+
NATIONALITY_EXPANDED_SPELLING = YML_NATIONALITY_EXPANDED_SPELLING.map { |_, v| v }.flatten.compact.sort
|
13
13
|
|
14
|
+
class Nationality
|
15
|
+
class << self
|
14
16
|
def count
|
15
17
|
NATIONALITY.map { |v| v }.flatten.count
|
16
18
|
end
|
17
19
|
|
18
|
-
def default_option(default_option)
|
19
|
-
nationalities = NATIONALITY
|
20
|
+
def default_option(default_option, expanded = false)
|
21
|
+
nationalities = expanded ? NATIONALITY_EXPANDED_SPELLING : NATIONALITY
|
20
22
|
|
21
|
-
default_nationality = default_option.split(
|
23
|
+
default_nationality = default_option.split(' ').map { |word| word.include?('and') ? word : word.capitalize }.join(' ')
|
22
24
|
|
23
25
|
if nationalities.include? default_nationality
|
24
|
-
nationalities
|
26
|
+
nationalities -= [default_nationality]
|
25
27
|
nationalities.unshift(default_nationality)
|
26
28
|
return nationalities
|
27
29
|
else
|
@@ -29,11 +31,10 @@ module Nationality
|
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
32
|
-
|
33
34
|
end
|
34
35
|
|
35
36
|
class NationalityNotFound < StandardError
|
36
|
-
def initialize(msg=
|
37
|
+
def initialize(msg = 'Nationality not found on the list')
|
37
38
|
super
|
38
39
|
end
|
39
40
|
end
|
data/lib/nationality/version.rb
CHANGED
@@ -0,0 +1,499 @@
|
|
1
|
+
nationality_expanded_spelling:
|
2
|
+
- "Abkhaz"
|
3
|
+
- "Acholi"
|
4
|
+
- "Afghan"
|
5
|
+
- "Afghani"
|
6
|
+
- "African"
|
7
|
+
- "African American"
|
8
|
+
- "Akan"
|
9
|
+
- "Albanian"
|
10
|
+
- "Algerian"
|
11
|
+
- "Altay"
|
12
|
+
- "Amara"
|
13
|
+
- "American"
|
14
|
+
- "Amharic"
|
15
|
+
- "Amish"
|
16
|
+
- "Ancient Egyptian"
|
17
|
+
- "Andorran"
|
18
|
+
- "Angolan"
|
19
|
+
- "Anishinabe"
|
20
|
+
- "Antiguan"
|
21
|
+
- "Antiguans"
|
22
|
+
- "Antillean"
|
23
|
+
- "Apache"
|
24
|
+
- "Arabic"
|
25
|
+
- "Arapaho"
|
26
|
+
- "Argentine"
|
27
|
+
- "Argentinean"
|
28
|
+
- "Argentinian"
|
29
|
+
- "Armenian"
|
30
|
+
- "Ashanti"
|
31
|
+
- "Assiniboine"
|
32
|
+
- "Assyrian"
|
33
|
+
- "Asturian"
|
34
|
+
- "Australian"
|
35
|
+
- "Australian Aboriginal"
|
36
|
+
- "Austrian"
|
37
|
+
- "Azande"
|
38
|
+
- "Azerbaijani"
|
39
|
+
- "Baguirmi"
|
40
|
+
- "Bahamian"
|
41
|
+
- "Bahaya"
|
42
|
+
- "Bahraini"
|
43
|
+
- "Bahumbu"
|
44
|
+
- "Bahunde"
|
45
|
+
- "Bajan"
|
46
|
+
- "Bakusu"
|
47
|
+
- "Balari"
|
48
|
+
- "Balinese"
|
49
|
+
- "Baluba"
|
50
|
+
- "Bambara"
|
51
|
+
- "Bamfinu"
|
52
|
+
- "Bamileke"
|
53
|
+
- "Bamoun"
|
54
|
+
- "Bangala"
|
55
|
+
- "Bangladeshi"
|
56
|
+
- "Bangwana"
|
57
|
+
- "Bantandu"
|
58
|
+
- "Bantu"
|
59
|
+
- "Barbadian"
|
60
|
+
- "Barbudans"
|
61
|
+
- "Basakata"
|
62
|
+
- "Basonge"
|
63
|
+
- "Basque"
|
64
|
+
- "Bassa"
|
65
|
+
- "Batabwa"
|
66
|
+
- "Bateke"
|
67
|
+
- "Batswana"
|
68
|
+
- "Bavarian"
|
69
|
+
- "Bayaka"
|
70
|
+
- "Bayansi"
|
71
|
+
- "Bayombe"
|
72
|
+
- "Bedouin"
|
73
|
+
- "Belarusian"
|
74
|
+
- "Belorussian"
|
75
|
+
- "Belgian"
|
76
|
+
- "Belizean"
|
77
|
+
- "Bemba"
|
78
|
+
- "Bengali"
|
79
|
+
- "Beninese"
|
80
|
+
- "Berber"
|
81
|
+
- "Beti"
|
82
|
+
- "Bhutanese"
|
83
|
+
- "Binza"
|
84
|
+
- "Blackfoot"
|
85
|
+
- "Bolivian"
|
86
|
+
- "Bondei"
|
87
|
+
- "Bornu"
|
88
|
+
- "Bosniak"
|
89
|
+
- "Bosnian"
|
90
|
+
- "Botswana"
|
91
|
+
- "Brazilian"
|
92
|
+
- "British"
|
93
|
+
- "British Overseas Territories Citizens"
|
94
|
+
- "Bruneian"
|
95
|
+
- "Buddhist"
|
96
|
+
- "Bugandan"
|
97
|
+
- "Bulgarian"
|
98
|
+
- "Burkina Faso"
|
99
|
+
- "Burkinabe"
|
100
|
+
- "Burmese"
|
101
|
+
- "Burundian"
|
102
|
+
- "Byzantine"
|
103
|
+
- "Cambodian"
|
104
|
+
- "Cameroonian"
|
105
|
+
- "Canadian"
|
106
|
+
- "Cape Verdean"
|
107
|
+
- "Catalan"
|
108
|
+
- "Celtic"
|
109
|
+
- "Central African"
|
110
|
+
- "Chadian"
|
111
|
+
- "Chechen"
|
112
|
+
- "Cherokee"
|
113
|
+
- "Cheyenne"
|
114
|
+
- "Chilean"
|
115
|
+
- "Chinese"
|
116
|
+
- "Chippewa"
|
117
|
+
- "Colombian"
|
118
|
+
- "Columbian"
|
119
|
+
- "Comanche"
|
120
|
+
- "Comoran"
|
121
|
+
- "Conastoga"
|
122
|
+
- "Congo"
|
123
|
+
- "Congolese"
|
124
|
+
- "Corsican"
|
125
|
+
- "Costa Rican"
|
126
|
+
- "Cree"
|
127
|
+
- "Creole"
|
128
|
+
- "Croatian"
|
129
|
+
- "Croation"
|
130
|
+
- "Crow"
|
131
|
+
- "Cuban"
|
132
|
+
- "Cypress"
|
133
|
+
- "Cypriot"
|
134
|
+
- "Czech"
|
135
|
+
- "Czechoslovak"
|
136
|
+
- "Czechoslovakian"
|
137
|
+
- "Dakota"
|
138
|
+
- "Danish"
|
139
|
+
- "Dayak"
|
140
|
+
- "Djibouti"
|
141
|
+
- "Dominican"
|
142
|
+
- "Douala"
|
143
|
+
- "Duala"
|
144
|
+
- "Dutch"
|
145
|
+
- "Duwamish"
|
146
|
+
- "East Timorese"
|
147
|
+
- "Ecuadoran"
|
148
|
+
- "Ecuadorean"
|
149
|
+
- "Ecuadorian"
|
150
|
+
- "Efik"
|
151
|
+
- "Egyptian"
|
152
|
+
- "Ekonda"
|
153
|
+
- "El Salvadoran"
|
154
|
+
- "Emirian"
|
155
|
+
- "English"
|
156
|
+
- "Equatorial Guinean"
|
157
|
+
- "Eritrean"
|
158
|
+
- "Eskimo"
|
159
|
+
- "Estonian"
|
160
|
+
- "Ethiopian"
|
161
|
+
- "European"
|
162
|
+
- "Ewe"
|
163
|
+
- "Fang"
|
164
|
+
- "Faroese"
|
165
|
+
- "Fiji"
|
166
|
+
- "Fijian"
|
167
|
+
- "Filipino"
|
168
|
+
- "Finnish"
|
169
|
+
- "Flemish"
|
170
|
+
- "Fox"
|
171
|
+
- "French"
|
172
|
+
- "Fulani"
|
173
|
+
- "Ga"
|
174
|
+
- "Gabonese"
|
175
|
+
- "Gaelic"
|
176
|
+
- "Galician"
|
177
|
+
- "Galla"
|
178
|
+
- "Gambia"
|
179
|
+
- "Gambian"
|
180
|
+
- "Ganda"
|
181
|
+
- "Genoese"
|
182
|
+
- "Georgian"
|
183
|
+
- "German"
|
184
|
+
- "Ghana"
|
185
|
+
- "Ghanaian"
|
186
|
+
- "Giryama"
|
187
|
+
- "Goan"
|
188
|
+
- "Golan"
|
189
|
+
- "Grebo"
|
190
|
+
- "Greek"
|
191
|
+
- "Grenadian"
|
192
|
+
- "Guatemalan"
|
193
|
+
- "Guinea-Bissauan"
|
194
|
+
- "Guinean"
|
195
|
+
- "Guyanan"
|
196
|
+
- "Guyanese"
|
197
|
+
- "Gypsy"
|
198
|
+
- "Haida"
|
199
|
+
- "Haitian"
|
200
|
+
- "Hausa"
|
201
|
+
- "Hawaiian"
|
202
|
+
- "Haya"
|
203
|
+
- "Hebrew"
|
204
|
+
- "Herero"
|
205
|
+
- "Herzegovinian"
|
206
|
+
- "Hewbrew"
|
207
|
+
- "Himalayan"
|
208
|
+
- "Hindu"
|
209
|
+
- "Hindustani"
|
210
|
+
- "Honduran"
|
211
|
+
- "Hopi"
|
212
|
+
- "Hungarian"
|
213
|
+
- "Huron"
|
214
|
+
- "I-Kiribati"
|
215
|
+
- "Ibo"
|
216
|
+
- "Icelander"
|
217
|
+
- "Icelandic"
|
218
|
+
- "Idoman"
|
219
|
+
- "Igbo"
|
220
|
+
- "Ila"
|
221
|
+
- "Ilocano"
|
222
|
+
- "Indian"
|
223
|
+
- "Indonesian"
|
224
|
+
- "Iowa"
|
225
|
+
- "Iranian"
|
226
|
+
- "Iraqi"
|
227
|
+
- "Irish"
|
228
|
+
- "Iroquois"
|
229
|
+
- "Israeli"
|
230
|
+
- "Italian"
|
231
|
+
- "Italiian"
|
232
|
+
- "Ivorian"
|
233
|
+
- "Jabo"
|
234
|
+
- "Jamaican"
|
235
|
+
- "Japanese"
|
236
|
+
- "Jewish"
|
237
|
+
- "Jordanian"
|
238
|
+
- "Kamba"
|
239
|
+
- "Kanem"
|
240
|
+
- "Kanuri"
|
241
|
+
- "Kaonde"
|
242
|
+
- "Kashmiri"
|
243
|
+
- "Kazakh"
|
244
|
+
- "Kazakhstani"
|
245
|
+
- "Kenyan"
|
246
|
+
- "Khakas"
|
247
|
+
- "Kiganda"
|
248
|
+
- "Kikuyu"
|
249
|
+
- "Kiowa"
|
250
|
+
- "Kittian and Nevisian"
|
251
|
+
- "Kongo"
|
252
|
+
- "Korean"
|
253
|
+
- "Kpelle"
|
254
|
+
- "Kurdish"
|
255
|
+
- "Kuwaiti"
|
256
|
+
- "Kyrgyz"
|
257
|
+
- "Lakota"
|
258
|
+
- "Lakotan"
|
259
|
+
- "Lancastrian"
|
260
|
+
- "Lao"
|
261
|
+
- "Laotian"
|
262
|
+
- "Lash"
|
263
|
+
- "Latin"
|
264
|
+
- "Latvian"
|
265
|
+
- "Lebanese"
|
266
|
+
- "Lesotho"
|
267
|
+
- "Liberia"
|
268
|
+
- "Liberian"
|
269
|
+
- "Libyan"
|
270
|
+
- "Liechtensteiner"
|
271
|
+
- "Lithuanian"
|
272
|
+
- "Lon"
|
273
|
+
- "Lula"
|
274
|
+
- "Lumbee"
|
275
|
+
- "Luo"
|
276
|
+
- "Luxembourger"
|
277
|
+
- "Luxembourgian"
|
278
|
+
- "Luxembourgish"
|
279
|
+
- "Maaori"
|
280
|
+
- "Maasai"
|
281
|
+
- "Macedonian"
|
282
|
+
- "Macua"
|
283
|
+
- "Malabar"
|
284
|
+
- "Malagasy"
|
285
|
+
- "Malawi"
|
286
|
+
- "Malawian"
|
287
|
+
- "Malaysian"
|
288
|
+
- "Maldivian"
|
289
|
+
- "Malian"
|
290
|
+
- "Maltese"
|
291
|
+
- "Mamprussi"
|
292
|
+
- "Mandingue"
|
293
|
+
- "Mannar"
|
294
|
+
- "Manx"
|
295
|
+
- "Maori"
|
296
|
+
- "Maricopa"
|
297
|
+
- "Marshallese"
|
298
|
+
- "Martinican"
|
299
|
+
- "Martiniquais"
|
300
|
+
- "Massai"
|
301
|
+
- "Mauritania"
|
302
|
+
- "Mauritanian"
|
303
|
+
- "Mauritian"
|
304
|
+
- "Medical"
|
305
|
+
- "Mennonite"
|
306
|
+
- "Mexican"
|
307
|
+
- "Micronesian"
|
308
|
+
- "Minah"
|
309
|
+
- "Mohawk"
|
310
|
+
- "Moldovan"
|
311
|
+
- "Monacan"
|
312
|
+
- "Mongo"
|
313
|
+
- "Mongolian"
|
314
|
+
- "Montenegrin"
|
315
|
+
- "Montenegro"
|
316
|
+
- "Moorish"
|
317
|
+
- "Moroccan"
|
318
|
+
- "Mosotho"
|
319
|
+
- "Motswana"
|
320
|
+
- "Mozambican"
|
321
|
+
- "Myanmar"
|
322
|
+
- "Myanmaran"
|
323
|
+
- "Namibian"
|
324
|
+
- "Native American"
|
325
|
+
- "Nauruan"
|
326
|
+
- "Navajo"
|
327
|
+
- "Ndebele"
|
328
|
+
- "Ndongan"
|
329
|
+
- "Near East"
|
330
|
+
- "Nepal"
|
331
|
+
- "Nepalese"
|
332
|
+
- "New Zealander"
|
333
|
+
- "Nez Perce"
|
334
|
+
- "Ngandi"
|
335
|
+
- "Ni-Vanuatu"
|
336
|
+
- "Nicaraguan"
|
337
|
+
- "Niger"
|
338
|
+
- "Nigeria"
|
339
|
+
- "Nigerian"
|
340
|
+
- "Nigerien"
|
341
|
+
- "Nilotic"
|
342
|
+
- "Norse"
|
343
|
+
- "North Korean"
|
344
|
+
- "Northern Irish"
|
345
|
+
- "Norwegian"
|
346
|
+
- "Ntomba"
|
347
|
+
- "Nyang"
|
348
|
+
- "Nyanja"
|
349
|
+
- "Oglala Sioux"
|
350
|
+
- "Oji"
|
351
|
+
- "Ojibwa"
|
352
|
+
- "Ojibway"
|
353
|
+
- "Okinawian"
|
354
|
+
- "Oklahoma"
|
355
|
+
- "Omaha"
|
356
|
+
- "Omani"
|
357
|
+
- "Onondagan"
|
358
|
+
- "Oriental"
|
359
|
+
- "Oromo"
|
360
|
+
- "Osage"
|
361
|
+
- "Ovambo"
|
362
|
+
- "Ovimbundu"
|
363
|
+
- "Paiute"
|
364
|
+
- "Pakistani"
|
365
|
+
- "Palauan"
|
366
|
+
- "Palestinian"
|
367
|
+
- "Pampango"
|
368
|
+
- "Panamanian"
|
369
|
+
- "Papua New Guinean"
|
370
|
+
- "Paraguayan"
|
371
|
+
- "Pawnee"
|
372
|
+
- "Persian"
|
373
|
+
- "Peruvian"
|
374
|
+
- "Peul"
|
375
|
+
- "Pigmei"
|
376
|
+
- "Pima"
|
377
|
+
- "Plains"
|
378
|
+
- "Polish"
|
379
|
+
- "Portuguese"
|
380
|
+
- "Pueblo"
|
381
|
+
- "Puerto Rican"
|
382
|
+
- "Punjabi"
|
383
|
+
- "Pygmy"
|
384
|
+
- "Qatari"
|
385
|
+
- "Roman"
|
386
|
+
- "Romanian"
|
387
|
+
- "Rosicrucian"
|
388
|
+
- "Russian"
|
389
|
+
- "Rwanda"
|
390
|
+
- "Rwandan"
|
391
|
+
- "Saint Lucian"
|
392
|
+
- "Salvadoran"
|
393
|
+
- "Samoan"
|
394
|
+
- "San Marinese"
|
395
|
+
- "Sanskrit"
|
396
|
+
- "Sao Tomean"
|
397
|
+
- "Saudi"
|
398
|
+
- "Saudi Arabian"
|
399
|
+
- "SaudiRwanan"
|
400
|
+
- "Sauk"
|
401
|
+
- "Savoyard"
|
402
|
+
- "Scanian"
|
403
|
+
- "Scottish"
|
404
|
+
- "Scythian"
|
405
|
+
- "Seneca"
|
406
|
+
- "Senegalese"
|
407
|
+
- "Serbian"
|
408
|
+
- "Serbo-Croatian"
|
409
|
+
- "Serere"
|
410
|
+
- "Seychellois"
|
411
|
+
- "Shawnee"
|
412
|
+
- "Shenandoah"
|
413
|
+
- "Shona"
|
414
|
+
- "Shoshone"
|
415
|
+
- "Sicilian"
|
416
|
+
- "Sierra Leonean"
|
417
|
+
- "Singaporean"
|
418
|
+
- "Singhalese"
|
419
|
+
- "Sinhali"
|
420
|
+
- "Sioux"
|
421
|
+
- "Slovak"
|
422
|
+
- "Slovenian"
|
423
|
+
- "Solomon Islander"
|
424
|
+
- "Somali"
|
425
|
+
- "South African"
|
426
|
+
- "South American"
|
427
|
+
- "South Korean"
|
428
|
+
- "South Sotho"
|
429
|
+
- "Southwest"
|
430
|
+
- "Spanish"
|
431
|
+
- "Sri Lankan"
|
432
|
+
- "St. Kittsian"
|
433
|
+
- "Sudanese"
|
434
|
+
- "Sufi"
|
435
|
+
- "Sukuma"
|
436
|
+
- "Sumerian"
|
437
|
+
- "Surinam"
|
438
|
+
- "Surinamer"
|
439
|
+
- "Suyin"
|
440
|
+
- "Swahili"
|
441
|
+
- "Swazi"
|
442
|
+
- "Swedish"
|
443
|
+
- "Swiss"
|
444
|
+
- "Syrian"
|
445
|
+
- "Tadjik"
|
446
|
+
- "Tahitian"
|
447
|
+
- "Taiwanese"
|
448
|
+
- "Tajik"
|
449
|
+
- "Tamil"
|
450
|
+
- "Tanzanian"
|
451
|
+
- "Taoist"
|
452
|
+
- "Temne"
|
453
|
+
- "Teton Sioux"
|
454
|
+
- "Thai"
|
455
|
+
- "Thonga"
|
456
|
+
- "Tibetan"
|
457
|
+
- "Tobagonian"
|
458
|
+
- "Togolese"
|
459
|
+
- "Toma"
|
460
|
+
- "Tongan"
|
461
|
+
- "Trinidadian"
|
462
|
+
- "Tshi"
|
463
|
+
- "Tswana"
|
464
|
+
- "Tuareg"
|
465
|
+
- "Tunisian"
|
466
|
+
- "Tupuri"
|
467
|
+
- "Turkish"
|
468
|
+
- "Tuscarora"
|
469
|
+
- "Tuvaluan"
|
470
|
+
- "Twi"
|
471
|
+
- "Tywa"
|
472
|
+
- "Uganda"
|
473
|
+
- "Ugandan"
|
474
|
+
- "Ukrainian"
|
475
|
+
- "Umpqua"
|
476
|
+
- "Uruguayan"
|
477
|
+
- "Ute"
|
478
|
+
- "Uzbekistani"
|
479
|
+
- "Vai"
|
480
|
+
- "Venezuelan"
|
481
|
+
- "Vietnamese"
|
482
|
+
- "Virgin Islander"
|
483
|
+
- "Wadchagga"
|
484
|
+
- "Walloon"
|
485
|
+
- "Welsh"
|
486
|
+
- "Winnebago"
|
487
|
+
- "Wolof"
|
488
|
+
- "Xhosa"
|
489
|
+
- "Yemeni"
|
490
|
+
- "Yemenite"
|
491
|
+
- "Yiddish"
|
492
|
+
- "Yoruba"
|
493
|
+
- "Yugoslav"
|
494
|
+
- "Yugoslavian"
|
495
|
+
- "Yurok"
|
496
|
+
- "Zambian"
|
497
|
+
- "Zanzibar"
|
498
|
+
- "Zimbabwean"
|
499
|
+
- "Zulu"
|
data/nationality.gemspec
CHANGED
@@ -1,24 +1,26 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require 'nationality/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
|
-
gem.name =
|
6
|
+
gem.name = 'nationality'
|
7
7
|
gem.version = Nationality::VERSION
|
8
|
-
gem.authors = [
|
9
|
-
gem.email = [
|
10
|
-
gem.description =
|
11
|
-
gem.summary =
|
12
|
-
gem.homepage =
|
8
|
+
gem.authors = ['Jose Marie Antonio Miñoza']
|
9
|
+
gem.email = ['josemarieantoniominoza@gmail.com']
|
10
|
+
gem.description = 'Provides listing of nationality that you may need in your ruby applications.'
|
11
|
+
gem.summary = 'List of Nationality'
|
12
|
+
gem.homepage = 'https://github.com/JomaMinoza/nationality/'
|
13
13
|
|
14
|
-
gem.files = `git ls-files`.split(
|
15
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
-
gem.require_paths = [
|
17
|
+
gem.require_paths = ['lib']
|
18
18
|
|
19
|
-
gem.required_ruby_version =
|
19
|
+
gem.required_ruby_version = '>= 1.9.2'
|
20
20
|
|
21
|
-
gem.add_development_dependency
|
22
|
-
gem.add_development_dependency '
|
23
|
-
|
21
|
+
gem.add_development_dependency 'pry', '~> 0.12.2', '>= 0.12.2'
|
22
|
+
gem.add_development_dependency 'pry-byebug', '~> 3.7.0', '>= 3.7.0'
|
23
|
+
gem.add_development_dependency 'pry-doc', '~> 1.0.0', '>= 1.0.0'
|
24
|
+
gem.add_development_dependency 'rake', '~> 12.3.1', '>= 12.3.1'
|
25
|
+
gem.add_development_dependency 'rspec', '~> 3.8.0', '>= 3.8.0'
|
24
26
|
end
|
data/spec/nationality_spec.rb
CHANGED
@@ -1,31 +1,49 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Nationality do
|
4
|
-
|
5
|
-
context "constants" do
|
4
|
+
context 'constants' do
|
6
5
|
it { should have_constant(:NATIONALITY) }
|
6
|
+
it { should have_constant(:NATIONALITY_EXPANDED_SPELLING) }
|
7
7
|
end
|
8
8
|
|
9
|
-
context
|
10
|
-
it
|
11
|
-
Nationality::NATIONALITY.count.
|
9
|
+
context '::NATIONALITY' do
|
10
|
+
it 'should be 196' do
|
11
|
+
expect(Nationality::NATIONALITY.count).to eq(196)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
context '::NATIONALITY_EXPANDED_SPELLING' do
|
16
|
+
it 'should be 196' do
|
17
|
+
expect(Nationality::NATIONALITY_EXPANDED_SPELLING.count).to eq(498)
|
18
|
+
end
|
19
|
+
end
|
16
20
|
|
21
|
+
describe '::Nationality Class' do
|
17
22
|
describe '#default_option method' do
|
18
|
-
context
|
19
|
-
it
|
20
|
-
expect(Nationality::Nationality.default_option('filipino')[0]).to eq(
|
23
|
+
context 'When Nationality exists' do
|
24
|
+
it 'should return the first option selected' do
|
25
|
+
expect(Nationality::Nationality.default_option('filipino')[0]).to eq('Filipino')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'When Nationality does not exists' do
|
30
|
+
it 'should raise NationalityNotFound error' do
|
31
|
+
expect { Nationality::Nationality.default_option('Jejemon') }.to raise_error(Nationality::NationalityNotFound)
|
21
32
|
end
|
22
33
|
end
|
23
34
|
|
24
|
-
context
|
25
|
-
it
|
26
|
-
expect
|
35
|
+
context 'When Nationality with Expanded Spelling exists' do
|
36
|
+
it 'should return the first option selected' do
|
37
|
+
expect(Nationality::Nationality.default_option('belorussian', 'expanded')[0]).to eq('Belorussian')
|
27
38
|
end
|
28
39
|
end
|
40
|
+
|
41
|
+
context 'When Nationality does not exists' do
|
42
|
+
it 'should raise NationalityNotFound error' do
|
43
|
+
expect { Nationality::Nationality.default_option('Jejemon', 'expanded') }.to raise_error(Nationality::NationalityNotFound)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
29
47
|
end
|
30
48
|
|
31
49
|
describe '#count method' do
|
@@ -35,9 +53,9 @@ describe Nationality do
|
|
35
53
|
end
|
36
54
|
end
|
37
55
|
|
38
|
-
describe
|
39
|
-
it
|
40
|
-
expect { raise Nationality::NationalityNotFound }.to raise_error(
|
56
|
+
describe '::NationalityNotFound Error Class' do
|
57
|
+
it 'should raise NationalityNotFound error' do
|
58
|
+
expect { raise Nationality::NationalityNotFound }.to raise_error(Nationality::NationalityNotFound)
|
41
59
|
end
|
42
60
|
end
|
43
61
|
end
|
metadata
CHANGED
@@ -1,49 +1,115 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nationality
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Marie Antonio Miñoza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.12.2
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.12.2
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.12.2
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.12.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: pry-byebug
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 3.7.0
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.7.0
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.7.0
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.7.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: pry-doc
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.0.0
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.0.0
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.0.0
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 1.0.0
|
13
73
|
- !ruby/object:Gem::Dependency
|
14
74
|
name: rake
|
15
75
|
requirement: !ruby/object:Gem::Requirement
|
16
76
|
requirements:
|
17
77
|
- - "~>"
|
18
78
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
79
|
+
version: 12.3.1
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 12.3.1
|
20
83
|
type: :development
|
21
84
|
prerelease: false
|
22
85
|
version_requirements: !ruby/object:Gem::Requirement
|
23
86
|
requirements:
|
24
87
|
- - "~>"
|
25
88
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
89
|
+
version: 12.3.1
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 12.3.1
|
27
93
|
- !ruby/object:Gem::Dependency
|
28
94
|
name: rspec
|
29
95
|
requirement: !ruby/object:Gem::Requirement
|
30
96
|
requirements:
|
31
97
|
- - "~>"
|
32
98
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
99
|
+
version: 3.8.0
|
34
100
|
- - ">="
|
35
101
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
102
|
+
version: 3.8.0
|
37
103
|
type: :development
|
38
104
|
prerelease: false
|
39
105
|
version_requirements: !ruby/object:Gem::Requirement
|
40
106
|
requirements:
|
41
107
|
- - "~>"
|
42
108
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
109
|
+
version: 3.8.0
|
44
110
|
- - ">="
|
45
111
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
112
|
+
version: 3.8.0
|
47
113
|
description: Provides listing of nationality that you may need in your ruby applications.
|
48
114
|
email:
|
49
115
|
- josemarieantoniominoza@gmail.com
|
@@ -59,6 +125,7 @@ files:
|
|
59
125
|
- lib/nationality.rb
|
60
126
|
- lib/nationality/version.rb
|
61
127
|
- lib/nationality/yml/nationality.yml
|
128
|
+
- lib/nationality/yml/nationality_expanded_spelling.yml
|
62
129
|
- nationality.gemspec
|
63
130
|
- spec/nationality_spec.rb
|
64
131
|
- spec/spec_helper.rb
|
@@ -81,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
148
|
version: '0'
|
82
149
|
requirements: []
|
83
150
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.7.6
|
85
152
|
signing_key:
|
86
153
|
specification_version: 4
|
87
154
|
summary: List of Nationality
|