UsaStates is tiny gem that provides full list of USA states
Add this line to your application's Gemfile:
gem 'usa_states'
And then execute:
$ bundle
Or install it yourself as:
$ gem install usa_states
You can get list of state codes strings with:
UsaStates.codes
List of states was taken from this gist.
{ AK: 'Alaska',
AL: 'Alabama',
AR: 'Arkansas',
AS: 'American Samoa',
AZ: 'Arizona',
CA: 'California',
CO: 'Colorado',
CT: 'Connecticut',
DC: 'District of Columbia',
DE: 'Delaware',
FL: 'Florida',
GA: 'Georgia',
GU: 'Guam',
HI: 'Hawaii',
IA: 'Iowa',
ID: 'Idaho',
IL: 'Illinois',
IN: 'Indiana',
KS: 'Kansas',
KY: 'Kentucky',
LA: 'Louisiana',
MA: 'Massachusetts',
MD: 'Maryland',
ME: 'Maine',
MI: 'Michigan',
MN: 'Minnesota',
MO: 'Missouri',
MS: 'Mississippi',
MT: 'Montana',
NC: 'North Carolina',
ND: 'North Dakota',
NE: 'Nebraska',
NH: 'New Hampshire',
NJ: 'New Jersey',
NM: 'New Mexico',
NV: 'Nevada',
NY: 'New York',
OH: 'Ohio',
OK: 'Oklahoma',
OR: 'Oregon',
PA: 'Pennsylvania',
PR: 'Puerto Rico',
RI: 'Rhode Island',
SC: 'South Carolina',
SD: 'South Dakota',
TN: 'Tennessee',
TX: 'Texas',
UT: 'Utah',
VA: 'Virginia',
VI: 'Virgin Islands',
VT: 'Vermont',
WA: 'Washington',
WI: 'Wisconsin',
WV: 'West Virginia',
WY: 'Wyoming'
}
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
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.
Bug reports and pull requests are welcome on GitHub at https://github.com/matic-insurance/usa_states.