geographer¶ ↑
DESCRIPTION¶ ↑
Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)
FEATURES¶ ↑
-
States class containing information about the US states and territories.
PLANNED FEATURES¶ ↑
-
World countries list
-
US zip codes list and tools
INSTALL¶ ↑
gem sources -a http://gemcutter.org sudo gem install
INSTALL FOR RAILS¶ ↑
Add to environment file:
config.gem "geographer", :version => '1.1.1', :source => 'http://gemcutter.org'
You will need to create classes and include modules in order to use geographer. You can do this in the lib directory, an initializer, etc.:
class States include Geographer::Us::States end
USAGE¶ ↑
The examples are based on the States class created above.
For a list (array) of state abbreviations:
States.abbreviations
For a list (array) of state names:
States.names
For a list (array) of state abbreviations with US territories:
States.abbreviations_with_territories
For a list (array) of state names with US territories:
States.names_with_territories
For a list (array) of territory abbreviations:
States.territories_abbreviations
For a list (array) of territory names:
States.territories_names
To look up the full name from the abbreviation:
States.abbreviations_name_map['AL'] # returns 'Alabama'
LICENSE¶ ↑
(The MIT License)
Copyright © 2009 C. Jason Harrelson (midas)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.