Convert 2-letter State Name to Full State Name (Ruby)

I recently ran across some old code that was using a database table to convert 2-letter state names (ex “NY”) to full state names (“New York”).  The process of hitting the database (or even joining) seemed a little excessive, so I dumped the “states” table into a CSV, wrote a Ruby script to convert the data to a hash, then wrote this little helper method.

Enjoy.

Hi there, I'm Jon.

Writer. Musician. Adventurer. Nerd.

Purveyor of GIFs and dad jokes.