A dirt simple Ruby gem for working with US state names and abbreviations.
This is the Ruby version of the Node.js madison and was built as an example gem for other developers.
The released gem (recommended):
gem install madison
Alternatively, from source code:
git clone https://github.com/mdb/madison.rb
cd madison.rb
bundle install
rake install
(Assuming you've installed from source code)
rake
(Again, assuming you've installed from source code)
open coverage/index.html
Require madison:
require 'madison'
Get a state's abbreviation:
Madison.get_abbrev 'virginia' // 'VA'
Get a state's name asynchronously:
Madison.get_name 'va' // 'Virginia'
Get a Ruby hash of US states, each containing 'name' and 'abbr' properties:
Madison.states