Skip to content
/ model_un Public
forked from uhhuhyeah/model_un

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

Notifications You must be signed in to change notification settings

reger/model_un

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 [email protected], or feel free for send me a patch.

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%