geography_helper 0.1.0
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 +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/geography_helper.gemspec +24 -0
- data/lib/geography_helper.rb +7 -0
- data/lib/geography_helper/countries.rb +254 -0
- data/lib/geography_helper/form_options_helper.rb +20 -0
- data/lib/geography_helper/states.rb +86 -0
- data/lib/geography_helper/version.rb +3 -0
- metadata +110 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Eric Iacutone
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# GeographyHelper
|
2
|
+
|
3
|
+
One source of truth for countries both states and provinces. I built this because it is easy to get into the habit of putting an array of arrays of states and countries into `application.rb`. This gem also uses hashes instead of nested arrays, making it easier to call values from a key. This approach is more efficient than looping through an array of arrays to find a correct state or country value. It is also easier to understand, for example, calling `state['NY'] => 'New York'`.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'geography_helper'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install geography_helper
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
call `GeographyHelper.states` for a hash of states and provinces
|
24
|
+
call `GeographyHelper.countries` for a hash of countries
|
25
|
+
|
26
|
+
The gem also provides helper two methods to render state/province and country dropdowns from a Rails select dropdown.
|
27
|
+
|
28
|
+
* `country_options_for_select`
|
29
|
+
* `state_options_for_select`
|
30
|
+
|
31
|
+
``` ruby example.html.erb
|
32
|
+
<%= form.select :country, country_options_for_select, {include_blank: true} %>
|
33
|
+
```
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/iacutone/geography_helper.
|
44
|
+
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
49
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "geography_helper"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -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 'geography_helper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "geography_helper"
|
8
|
+
spec.version = GeographyHelper::VERSION
|
9
|
+
spec.authors = ["Eric Iacutone"]
|
10
|
+
spec.email = ["eric.iacutone@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Hash state, province and country codes."
|
13
|
+
spec.homepage = "https://github.com/iacutone/geography_helper"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
@@ -0,0 +1,254 @@
|
|
1
|
+
module GeographyHelper
|
2
|
+
class Countries
|
3
|
+
|
4
|
+
def countries
|
5
|
+
{
|
6
|
+
'US' => 'United States',
|
7
|
+
'AF' => 'Afghanistan',
|
8
|
+
'AX' => 'Aland Islands',
|
9
|
+
'AL' => 'Albania',
|
10
|
+
'DZ' => 'Algeria',
|
11
|
+
'AS' => 'American Samoa',
|
12
|
+
'AD' => 'Andorra',
|
13
|
+
'AO' => 'Angola',
|
14
|
+
'AI' => 'Anguilla',
|
15
|
+
'AQ' => 'Antarctica',
|
16
|
+
'AG' => 'Antigua And Barbuda',
|
17
|
+
'AR' => 'Argentina',
|
18
|
+
'AM' => 'Armenia',
|
19
|
+
'AW' => 'Aruba',
|
20
|
+
'AU' => 'Australia',
|
21
|
+
'AT' => 'Austria',
|
22
|
+
'AZ' => 'Azerbaijan',
|
23
|
+
'BS' => 'Bahamas',
|
24
|
+
'BH' => 'Bahrain',
|
25
|
+
'BD' => 'Bangladesh',
|
26
|
+
'BB' => 'Barbados',
|
27
|
+
'BY' => 'Belarus',
|
28
|
+
'BE' => 'Belgium',
|
29
|
+
'BZ' => 'Belize',
|
30
|
+
'BJ' => 'Benin',
|
31
|
+
'BM' => 'Bermuda',
|
32
|
+
'BT' => 'Bhutan',
|
33
|
+
'BO' => 'Bolivia',
|
34
|
+
'BA' => 'Bosnia And Herzegovina',
|
35
|
+
'BW' => 'Botswana',
|
36
|
+
'BV' => 'Bouvet Island',
|
37
|
+
'BR' => 'Brazil',
|
38
|
+
'IO' => 'British Indian Ocean Territory',
|
39
|
+
'BN' => 'Brunei Darussalam',
|
40
|
+
'BG' => 'Bulgaria',
|
41
|
+
'BF' => 'Burkina Faso',
|
42
|
+
'BI' => 'Burundi',
|
43
|
+
'KH' => 'Cambodia',
|
44
|
+
'CM' => 'Cameroon',
|
45
|
+
'CA' => 'Canada',
|
46
|
+
'CV' => 'Cape Verde',
|
47
|
+
'KY' => 'Cayman Islands',
|
48
|
+
'CF' => 'Central African Republic',
|
49
|
+
'TD' => 'Chad',
|
50
|
+
'CL' => 'Chile',
|
51
|
+
'CN' => 'China',
|
52
|
+
'CX' => 'Christmas Island',
|
53
|
+
'CC' => 'Cocos (Keeling) Islands',
|
54
|
+
'CO' => 'Colombia',
|
55
|
+
'KM' => 'Comoros',
|
56
|
+
'CG' => 'Congo',
|
57
|
+
'CD' => 'Congo, Democratic Republic',
|
58
|
+
'CK' => 'Cook Islands',
|
59
|
+
'CR' => 'Costa Rica',
|
60
|
+
'CI' => 'Cote D\'Ivoire',
|
61
|
+
'HR' => 'Croatia',
|
62
|
+
'CU' => 'Cuba',
|
63
|
+
'CY' => 'Cyprus',
|
64
|
+
'CZ' => 'Czech Republic',
|
65
|
+
'DK' => 'Denmark',
|
66
|
+
'DJ' => 'Djibouti',
|
67
|
+
'DM' => 'Dominica',
|
68
|
+
'DO' => 'Dominican Republic',
|
69
|
+
'EC' => 'Ecuador',
|
70
|
+
'EG' => 'Egypt',
|
71
|
+
'SV' => 'El Salvador',
|
72
|
+
'GQ' => 'Equatorial Guinea',
|
73
|
+
'ER' => 'Eritrea',
|
74
|
+
'EE' => 'Estonia',
|
75
|
+
'ET' => 'Ethiopia',
|
76
|
+
'FK' => 'Falkland Islands (Malvinas)',
|
77
|
+
'FO' => 'Faroe Islands',
|
78
|
+
'FJ' => 'Fiji',
|
79
|
+
'FI' => 'Finland',
|
80
|
+
'FR' => 'France',
|
81
|
+
'GF' => 'French Guiana',
|
82
|
+
'PF' => 'French Polynesia',
|
83
|
+
'TF' => 'French Southern Territories',
|
84
|
+
'GA' => 'Gabon',
|
85
|
+
'GM' => 'Gambia',
|
86
|
+
'GE' => 'Georgia',
|
87
|
+
'DE' => 'Germany',
|
88
|
+
'GH' => 'Ghana',
|
89
|
+
'GI' => 'Gibraltar',
|
90
|
+
'GR' => 'Greece',
|
91
|
+
'GL' => 'Greenland',
|
92
|
+
'GD' => 'Grenada',
|
93
|
+
'GP' => 'Guadeloupe',
|
94
|
+
'GU' => 'Guam',
|
95
|
+
'GT' => 'Guatemala',
|
96
|
+
'GG' => 'Guernsey',
|
97
|
+
'GN' => 'Guinea',
|
98
|
+
'GW' => 'Guinea-Bissau',
|
99
|
+
'GY' => 'Guyana',
|
100
|
+
'HT' => 'Haiti',
|
101
|
+
'HM' => 'Heard Island & Mcdonald Islands',
|
102
|
+
'VA' => 'Holy See (Vatican City State)',
|
103
|
+
'HN' => 'Honduras',
|
104
|
+
'HK' => 'Hong Kong',
|
105
|
+
'HU' => 'Hungary',
|
106
|
+
'IS' => 'Iceland',
|
107
|
+
'IN' => 'India',
|
108
|
+
'ID' => 'Indonesia',
|
109
|
+
'IR' => 'Iran, Islamic Republic Of',
|
110
|
+
'IQ' => 'Iraq',
|
111
|
+
'IE' => 'Ireland',
|
112
|
+
'IM' => 'Isle Of Man',
|
113
|
+
'IL' => 'Israel',
|
114
|
+
'IT' => 'Italy',
|
115
|
+
'JM' => 'Jamaica',
|
116
|
+
'JP' => 'Japan',
|
117
|
+
'JE' => 'Jersey',
|
118
|
+
'JO' => 'Jordan',
|
119
|
+
'KZ' => 'Kazakhstan',
|
120
|
+
'KE' => 'Kenya',
|
121
|
+
'KI' => 'Kiribati',
|
122
|
+
'KR' => 'Korea',
|
123
|
+
'KW' => 'Kuwait',
|
124
|
+
'KG' => 'Kyrgyzstan',
|
125
|
+
'LA' => 'Lao People\'s Democratic Republic',
|
126
|
+
'LV' => 'Latvia',
|
127
|
+
'LB' => 'Lebanon',
|
128
|
+
'LS' => 'Lesotho',
|
129
|
+
'LR' => 'Liberia',
|
130
|
+
'LY' => 'Libyan Arab Jamahiriya',
|
131
|
+
'LI' => 'Liechtenstein',
|
132
|
+
'LT' => 'Lithuania',
|
133
|
+
'LU' => 'Luxembourg',
|
134
|
+
'MO' => 'Macao',
|
135
|
+
'MK' => 'Macedonia',
|
136
|
+
'MG' => 'Madagascar',
|
137
|
+
'MW' => 'Malawi',
|
138
|
+
'MY' => 'Malaysia',
|
139
|
+
'MV' => 'Maldives',
|
140
|
+
'ML' => 'Mali',
|
141
|
+
'MT' => 'Malta',
|
142
|
+
'MH' => 'Marshall Islands',
|
143
|
+
'MQ' => 'Martinique',
|
144
|
+
'MR' => 'Mauritania',
|
145
|
+
'MU' => 'Mauritius',
|
146
|
+
'YT' => 'Mayotte',
|
147
|
+
'MX' => 'Mexico',
|
148
|
+
'FM' => 'Micronesia, Federated States Of',
|
149
|
+
'MD' => 'Moldova',
|
150
|
+
'MC' => 'Monaco',
|
151
|
+
'MN' => 'Mongolia',
|
152
|
+
'ME' => 'Montenegro',
|
153
|
+
'MS' => 'Montserrat',
|
154
|
+
'MA' => 'Morocco',
|
155
|
+
'MZ' => 'Mozambique',
|
156
|
+
'MM' => 'Myanmar',
|
157
|
+
'NA' => 'Namibia',
|
158
|
+
'NR' => 'Nauru',
|
159
|
+
'NP' => 'Nepal',
|
160
|
+
'NL' => 'Netherlands',
|
161
|
+
'AN' => 'Netherlands Antilles',
|
162
|
+
'NC' => 'New Caledonia',
|
163
|
+
'NZ' => 'New Zealand',
|
164
|
+
'NI' => 'Nicaragua',
|
165
|
+
'NE' => 'Niger',
|
166
|
+
'NG' => 'Nigeria',
|
167
|
+
'NU' => 'Niue',
|
168
|
+
'NF' => 'Norfolk Island',
|
169
|
+
'MP' => 'Northern Mariana Islands',
|
170
|
+
'NO' => 'Norway',
|
171
|
+
'OM' => 'Oman',
|
172
|
+
'PK' => 'Pakistan',
|
173
|
+
'PW' => 'Palau',
|
174
|
+
'PS' => 'Palestinian Territory, Occupied',
|
175
|
+
'PA' => 'Panama',
|
176
|
+
'PG' => 'Papua New Guinea',
|
177
|
+
'PY' => 'Paraguay',
|
178
|
+
'PE' => 'Peru',
|
179
|
+
'PH' => 'Philippines',
|
180
|
+
'PN' => 'Pitcairn',
|
181
|
+
'PL' => 'Poland',
|
182
|
+
'PT' => 'Portugal',
|
183
|
+
'PR' => 'Puerto Rico',
|
184
|
+
'QA' => 'Qatar',
|
185
|
+
'RE' => 'Reunion',
|
186
|
+
'RO' => 'Romania',
|
187
|
+
'RU' => 'Russian Federation',
|
188
|
+
'RW' => 'Rwanda',
|
189
|
+
'BL' => 'Saint Barthelemy',
|
190
|
+
'SH' => 'Saint Helena',
|
191
|
+
'KN' => 'Saint Kitts And Nevis',
|
192
|
+
'LC' => 'Saint Lucia',
|
193
|
+
'MF' => 'Saint Martin',
|
194
|
+
'PM' => 'Saint Pierre And Miquelon',
|
195
|
+
'VC' => 'Saint Vincent And Grenadines',
|
196
|
+
'WS' => 'Samoa',
|
197
|
+
'SM' => 'San Marino',
|
198
|
+
'ST' => 'Sao Tome And Principe',
|
199
|
+
'SA' => 'Saudi Arabia',
|
200
|
+
'SN' => 'Senegal',
|
201
|
+
'RS' => 'Serbia',
|
202
|
+
'SC' => 'Seychelles',
|
203
|
+
'SL' => 'Sierra Leone',
|
204
|
+
'SG' => 'Singapore',
|
205
|
+
'SK' => 'Slovakia',
|
206
|
+
'SI' => 'Slovenia',
|
207
|
+
'SB' => 'Solomon Islands',
|
208
|
+
'SO' => 'Somalia',
|
209
|
+
'ZA' => 'South Africa',
|
210
|
+
'GS' => 'South Georgia And Sandwich Isl.',
|
211
|
+
'ES' => 'Spain',
|
212
|
+
'LK' => 'Sri Lanka',
|
213
|
+
'SD' => 'Sudan',
|
214
|
+
'SR' => 'Suriname',
|
215
|
+
'SJ' => 'Svalbard And Jan Mayen',
|
216
|
+
'SZ' => 'Swaziland',
|
217
|
+
'SE' => 'Sweden',
|
218
|
+
'CH' => 'Switzerland',
|
219
|
+
'SY' => 'Syrian Arab Republic',
|
220
|
+
'TW' => 'Taiwan',
|
221
|
+
'TJ' => 'Tajikistan',
|
222
|
+
'TZ' => 'Tanzania',
|
223
|
+
'TH' => 'Thailand',
|
224
|
+
'TL' => 'Timor-Leste',
|
225
|
+
'TG' => 'Togo',
|
226
|
+
'TK' => 'Tokelau',
|
227
|
+
'TO' => 'Tonga',
|
228
|
+
'TT' => 'Trinidad And Tobago',
|
229
|
+
'TN' => 'Tunisia',
|
230
|
+
'TR' => 'Turkey',
|
231
|
+
'TM' => 'Turkmenistan',
|
232
|
+
'TC' => 'Turks And Caicos Islands',
|
233
|
+
'TV' => 'Tuvalu',
|
234
|
+
'UG' => 'Uganda',
|
235
|
+
'UA' => 'Ukraine',
|
236
|
+
'AE' => 'United Arab Emirates',
|
237
|
+
'GB' => 'United Kingdom',
|
238
|
+
'UM' => 'United States Outlying Islands',
|
239
|
+
'UY' => 'Uruguay',
|
240
|
+
'UZ' => 'Uzbekistan',
|
241
|
+
'VU' => 'Vanuatu',
|
242
|
+
'VE' => 'Venezuela',
|
243
|
+
'VN' => 'Viet Nam',
|
244
|
+
'VG' => 'Virgin Islands, British',
|
245
|
+
'VI' => 'Virgin Islands, U.S.',
|
246
|
+
'WF' => 'Wallis And Futuna',
|
247
|
+
'EH' => 'Western Sahara',
|
248
|
+
'YE' => 'Yemen',
|
249
|
+
'ZM' => 'Zambia',
|
250
|
+
'ZW' => 'Zimbabwe'
|
251
|
+
}
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
module FormOptionsHelper
|
4
|
+
|
5
|
+
def state_options_for_select
|
6
|
+
geography = GeographyHelper::States.new
|
7
|
+
state_options = geography.states
|
8
|
+
province_options = geography.provinces
|
9
|
+
state_and_province_options = {'United States' => state_options['United States'].invert}.merge({'Canada' => province_options['Canada'].invert})
|
10
|
+
|
11
|
+
grouped_options_for_select(state_and_province_options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def country_options_for_select
|
15
|
+
geography = GeographyHelper::Countries.new
|
16
|
+
geography.countries.invert
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module GeographyHelper
|
2
|
+
class States
|
3
|
+
|
4
|
+
def states
|
5
|
+
{
|
6
|
+
'United States' => {
|
7
|
+
'AK' => 'Alaska',
|
8
|
+
'AL' => 'Alabama',
|
9
|
+
'AR' => 'Arkansas',
|
10
|
+
'AS' => 'American Samoa',
|
11
|
+
'AZ' => 'Arizona',
|
12
|
+
'CA' => 'California',
|
13
|
+
'CO' => 'Colorado',
|
14
|
+
'CT' => 'Connecticut',
|
15
|
+
'DC' => 'District of Columbia',
|
16
|
+
'DE' => 'Delaware',
|
17
|
+
'FL' => 'Florida',
|
18
|
+
'GA' => 'Georgia',
|
19
|
+
'GU' => 'Guam',
|
20
|
+
'HI' => 'Hawaii',
|
21
|
+
'IA' => 'Iowa',
|
22
|
+
'ID' => 'Idaho',
|
23
|
+
'IL' => 'Illinois',
|
24
|
+
'IN' => 'Indiana',
|
25
|
+
'KS' => 'Kansas',
|
26
|
+
'KY' => 'Kentucky',
|
27
|
+
'LA' => 'Louisiana',
|
28
|
+
'MA' => 'Massachusetts',
|
29
|
+
'MD' => 'Maryland',
|
30
|
+
'ME' => 'Maine',
|
31
|
+
'MI' => 'Michigan',
|
32
|
+
'MN' => 'Minnesota',
|
33
|
+
'MO' => 'Missouri',
|
34
|
+
'MS' => 'Mississippi',
|
35
|
+
'MT' => 'Montana',
|
36
|
+
'NC' => 'North Carolina',
|
37
|
+
'ND' => 'North Dakota',
|
38
|
+
'NE' => 'Nebraska',
|
39
|
+
'NH' => 'New Hampshire',
|
40
|
+
'NJ' => 'New Jersey',
|
41
|
+
'NM' => 'New Mexico',
|
42
|
+
'NV' => 'Nevada',
|
43
|
+
'NY' => 'New York',
|
44
|
+
'OH' => 'Ohio',
|
45
|
+
'OK' => 'Oklahoma',
|
46
|
+
'OR' => 'Oregon',
|
47
|
+
'PA' => 'Pennsylvania',
|
48
|
+
'PR' => 'Puerto Rico',
|
49
|
+
'RI' => 'Rhode Island',
|
50
|
+
'SC' => 'South Carolina',
|
51
|
+
'SD' => 'South Dakota',
|
52
|
+
'TN' => 'Tennessee',
|
53
|
+
'TX' => 'Texas',
|
54
|
+
'UT' => 'Utah',
|
55
|
+
'VA' => 'Virginia',
|
56
|
+
'VI' => 'Virgin Islands',
|
57
|
+
'VT' => 'Vermont',
|
58
|
+
'WA' => 'Washington',
|
59
|
+
'WI' => 'Wisconsin',
|
60
|
+
'WV' => 'West Virginia',
|
61
|
+
'WY' => 'Wyoming'
|
62
|
+
}
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def provinces
|
67
|
+
{
|
68
|
+
'Canada' => {
|
69
|
+
'AB' => 'Alberta',
|
70
|
+
'BC' => 'British Columbia',
|
71
|
+
'MB' => 'Manitoba',
|
72
|
+
'NB' => 'New Brunswick',
|
73
|
+
'NL' => 'Newfoundland and Labrador',
|
74
|
+
'NT' => 'Northwest Territories',
|
75
|
+
'NS' => 'Nova Scotia',
|
76
|
+
'NU' => 'Nunavut',
|
77
|
+
'PE' => 'Prince Edward Island',
|
78
|
+
'SK' => 'Saskatchewan',
|
79
|
+
'ON' => 'Ontario',
|
80
|
+
'QC' => 'Quebec',
|
81
|
+
'YT' => 'Yukon'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: geography_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Eric Iacutone
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2017-06-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.10'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.10'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '10.0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '10.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description:
|
63
|
+
email:
|
64
|
+
- eric.iacutone@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .rspec
|
71
|
+
- .travis.yml
|
72
|
+
- Gemfile
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- bin/console
|
77
|
+
- bin/setup
|
78
|
+
- geography_helper.gemspec
|
79
|
+
- lib/geography_helper.rb
|
80
|
+
- lib/geography_helper/countries.rb
|
81
|
+
- lib/geography_helper/form_options_helper.rb
|
82
|
+
- lib/geography_helper/states.rb
|
83
|
+
- lib/geography_helper/version.rb
|
84
|
+
homepage: https://github.com/iacutone/geography_helper
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.8.25
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: Hash state, province and country codes.
|
109
|
+
test_files: []
|
110
|
+
has_rdoc:
|