state_helper 0.0.1
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +16 -0
- data/Rakefile +21 -0
- data/lib/state_helper/states.rb +78 -0
- data/lib/state_helper/version.rb +3 -0
- data/lib/state_helper.rb +4 -0
- data/lib/tasks/state_helper_tasks.rake +4 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 589907f085973b55a95f65363d4433964aa59e4e
|
4
|
+
data.tar.gz: 2bae57bd3ce3759f04aebbd0419905283b384df3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f2cae8ae4ef6cbbc12fdd6b23516ba6e90827b52caed52c88b55d0c28c26430c40391c4ba08dcbe202087180f122e54bfa431eff20f2a72562add6bf25e0361
|
7
|
+
data.tar.gz: 32c45a8ee410b9ea8314ba48c2a0cb23c65678b230176b5978d800d9610bd67b807761647bb1ae115a69ec76d080f924194eeea17a8f215411d4b94e2e083481
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 YOURNAME
|
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,16 @@
|
|
1
|
+
= StateHelper
|
2
|
+
|
3
|
+
## US States Names and Codes
|
4
|
+
|
5
|
+
##### How it works
|
6
|
+
|
7
|
+
```
|
8
|
+
state_helper = StateHelper::States.new
|
9
|
+
state_helper.states # Returns a Hash of states, Key: Name => Value: Code
|
10
|
+
state_helper.names # Array if state names.
|
11
|
+
state_helper.codes # Array of state codes.
|
12
|
+
state_helper.get_name_by_code("UT") # Gets state's name by code, this would return Utah, which is a state.
|
13
|
+
state_helper.get_code_by_name("Utah") # This would get the state code, this would be UT.
|
14
|
+
```
|
15
|
+
|
16
|
+
This project rocks and uses MIT-LICENSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'StateHelper'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module StateHelper
|
2
|
+
class States
|
3
|
+
attr_reader :states
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@states = {
|
7
|
+
'Alabama' => 'AL',
|
8
|
+
'Alaska' => 'AK',
|
9
|
+
'Arizona' => 'AZ',
|
10
|
+
'Arkansas' => 'AR',
|
11
|
+
'California' => 'CA',
|
12
|
+
'Colorado' => 'CO',
|
13
|
+
'Connecticut' => 'CT',
|
14
|
+
'Delaware' => 'DE',
|
15
|
+
'Florida' => 'FL',
|
16
|
+
'Georgia' => 'GA',
|
17
|
+
'Hawaii' => 'HI',
|
18
|
+
'Idaho' => 'ID',
|
19
|
+
'Illinois' => 'IL',
|
20
|
+
'Indiana' => 'IN',
|
21
|
+
'Iowa' => 'IA',
|
22
|
+
'Kansas' => 'KS',
|
23
|
+
'Kentucky' => 'KY',
|
24
|
+
'Louisiana' => 'LA',
|
25
|
+
'Maine' => 'ME',
|
26
|
+
'Maryland' => 'MD',
|
27
|
+
'Massachusetts' => 'MA',
|
28
|
+
'Michigan' => 'MI',
|
29
|
+
'Minnesota' => 'MN',
|
30
|
+
'Mississippi' => 'MS',
|
31
|
+
'Missouri' => 'MO',
|
32
|
+
'Montana' => 'MT',
|
33
|
+
'Nebraska' => 'NE',
|
34
|
+
'Nevada' => 'NV',
|
35
|
+
'New Hampshire' => 'NH',
|
36
|
+
'New Jersey' => 'NJ',
|
37
|
+
'New Mexico' => 'NM',
|
38
|
+
'New York' => 'NY',
|
39
|
+
'North Carolina' => 'NC',
|
40
|
+
'North Dakota' => 'ND',
|
41
|
+
'Ohio' => 'OH',
|
42
|
+
'Oklahoma' => 'OK',
|
43
|
+
'Oregon' => 'OR',
|
44
|
+
'Pennsylvania' => 'PA',
|
45
|
+
'Rhode Island' => 'RI',
|
46
|
+
'South Carolina' => 'SC',
|
47
|
+
'South Dakota' => 'SD',
|
48
|
+
'Tennessee' => 'TN',
|
49
|
+
'Texas' => 'TX',
|
50
|
+
'Utah' => 'UT',
|
51
|
+
'Vermont' => 'VT',
|
52
|
+
'Virginia' => 'VA',
|
53
|
+
'Washington' => 'WA',
|
54
|
+
'West Virginia' => 'WV',
|
55
|
+
'Wisconsin' => 'WI',
|
56
|
+
'Wyoming' => 'WY',
|
57
|
+
'Washington DC' => 'DC'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def codes
|
62
|
+
@states.values
|
63
|
+
end
|
64
|
+
|
65
|
+
def names
|
66
|
+
@states.keys
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_name_by_code code
|
70
|
+
@states.select {|key, value| value == code.upcase}.first.first
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_code_by_name name
|
74
|
+
@states[name.titleize]
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
data/lib/state_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: state_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathan Daily
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: get state name and code by either.
|
14
|
+
email:
|
15
|
+
- ndaily@netmediagroup.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- MIT-LICENSE
|
21
|
+
- README.rdoc
|
22
|
+
- Rakefile
|
23
|
+
- lib/state_helper.rb
|
24
|
+
- lib/state_helper/states.rb
|
25
|
+
- lib/state_helper/version.rb
|
26
|
+
- lib/tasks/state_helper_tasks.rake
|
27
|
+
homepage: https://www.netmediagroup.com
|
28
|
+
licenses:
|
29
|
+
- MIT
|
30
|
+
metadata: {}
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubyforge_project:
|
47
|
+
rubygems_version: 2.4.5
|
48
|
+
signing_key:
|
49
|
+
specification_version: 4
|
50
|
+
summary: A State Helper.
|
51
|
+
test_files: []
|