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
gem install model_un
my_state = 'California'
my_state_abbr = ModelUN.convert_state_name(my_state) # returns 'CA'
my_state_abbr = 'CA'
my_state_name = ModelUN.convert_state_abbr(my_state_abbr) # returns 'California'
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'
my_country = 'Sweden'
my_country_abbr = ModelUN.convert_country_name(my_country) # returns 'SWE'
my_country_abbr = 'SWE'
my_country_name = ModelUN.convert_country_abbr(my_country_abbr) # returns 'Sweden'
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'
- Supports conversion of US State names (including Guam, Marshal and Virgin Islands)
- Supports conversion of Countries against NATO Country names and codes
- Support converting countries by their common "nick names". E.g. Accepting "United Kingdom" for "United Kingdom of Great Britain and Northern Ireland"
- No known issues. Please report bugs to [email protected], or feel free for send me a patch.