Build Status

madison

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.

Installation

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

Run Rspec tests

(Assuming you've installed from source code)

rake

View code coverage after running Rspec tests

(Again, assuming you've installed from source code)

open coverage/index.html

Usage

Require madison:

require 'madison'

Initialize madison:

m = Madison.new

Get a state's abbreviation:

m.get_abbrev 'virginia' // 'VA'

Get a state's name asynchronously:

m.get_name 'va' // 'Virginia'

Get a Ruby hash of US states, each containing 'name' and 'abbr' properties:

m.states