Project

model_un

0.01
No commit activity in last 3 years
No release in over 3 years
Converts US State names and (most) country names to their normally accepted abbreviations and back.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

ModelUN - Quick and easy country and US State abbreviations

ModelUN is a tiny little Ruby library for abbreviating and, er, de-abbreviating Countries and US State names.

Brought to you by Uh Huh Yeah with help and encouragement from Climber.com

Installation

gem install model_un

ModelUN API - US States

Convert a US State to it's abbreviated name

	my_state = 'California'
	my_state_abbr = ModelUN.convert_state_name(my_state) # returns 'CA'

Convert a US State abbreviation to it's full name

	my_state_abbr = 'CA'
	my_state_name = ModelUN.convert_state_abbr(my_state_abbr) # returns 'California'

Or, a shortcut for either method

	my_state = 'California'
	my_state_abbr = ModelUN.convert(my_state) # returns 'CA'	

	my_state_abbr = 'CA'
	my_state_name = ModelUN.convert(my_state_abbr) # returns 'California'

ModelUN API - Countries

Convert a Country to it's (NATO) abbreviated name

	my_country = 'Sweden'
	my_country_abbr = ModelUN.convert_country_name(my_country) # returns 'SWE'

Convert a NATO Country abbreviation to it's full name

	my_country_abbr = 'SWE'
	my_country_name = ModelUN.convert_country_abbr(my_country_abbr) # returns 'Sweden'

Or, a shortcut for either method

	my_country = 'Sweden'
	my_country_abbr = ModelUN.convert(my_country) # returns 'SWE'	

	my_country_abbr = 'SWE'
	my_country_name = ModelUN.convert(my_country_abbr) # returns 'Sweden'

Current version: v0.2 (February 2011)

  • Supports conversion of US State names (including Guam, Marshal and Virgin Islands)
  • Supports conversion of Countries against NATO Country names and codes

Upcoming features:

  • Support converting countries by their common "nick names". E.g. Accepting "United Kingdom" for "United Kingdom of Great Britain and Northern Ireland"

Known issues

  • No known issues. Please report bugs to david@uhhuhyeah.com, or feel free for send me a patch.