Module: Geographer::Us::States::ClassMethods
- Defined in:
- lib/geographer/us/states.rb
Instance Method Summary collapse
-
#abbreviations ⇒ Object
A list of abbreviatons of US States and territories.
-
#abbreviations_name_map ⇒ Object
An index (map) of US States and territories abbreviations and full names, keyed by the abbreviation.
-
#abbreviations_with_territories ⇒ Object
A list of abbreviatons of US States and territories.
-
#by_abbreviation ⇒ Object
Alias for abbreviations_name_map.
-
#by_name ⇒ Object
Alias for names_abbreviation_map.
-
#names ⇒ Object
A list of names of US States only (no territories).
-
#names_abbreviation_map ⇒ Object
An index (map) of US States and territories abbreviations and full names, keyed by the name.
-
#names_with_territories ⇒ Object
A list of names of US States and territories.
-
#territories_abbreviations ⇒ Object
A list of abbreviatons of US territories.
- #territories_names ⇒ Object
Instance Method Details
#abbreviations ⇒ Object
A list of abbreviatons of US States and territories.
16 17 18 |
# File 'lib/geographer/us/states.rb', line 16 def abbreviations self.abbreviations_with_territories - self.territories_abbreviations end |
#abbreviations_name_map ⇒ Object
An index (map) of US States and territories abbreviations and full names, keyed by the abbreviation.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/geographer/us/states.rb', line 50 def abbreviations_name_map @@abbreviations_name_map ||= { 'AL' => 'Alabama', 'AK' => 'Alaska', 'AS' => 'American Samoa', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', 'DC' => 'District of Columbia', 'FM' => 'Micronesia', 'FL' => 'Florida', 'GA' => 'Georgia', 'GU' => 'Guam', 'HI' => 'Hawaii', 'ID' => 'Idaho', 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MH' => 'Islands', 'MD' => 'Maryland', 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PW' => 'Palau', 'PA' => 'Pennsylvania', 'PR' => 'Puerto Rico', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', 'VT' => 'Vermont', 'VI' => 'Virgin Island', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', 'WI' => 'Wisconsin', 'WY' => 'Wyoming' } return @@abbreviations_name_map end |
#abbreviations_with_territories ⇒ Object
A list of abbreviatons of US States and territories.
28 29 30 |
# File 'lib/geographer/us/states.rb', line 28 def abbreviations_with_territories self.abbreviations_name_map.keys.sort end |
#by_abbreviation ⇒ Object
Alias for abbreviations_name_map
124 125 126 |
# File 'lib/geographer/us/states.rb', line 124 def by_abbreviation self.abbreviations_name_map end |
#by_name ⇒ Object
Alias for names_abbreviation_map
130 131 132 |
# File 'lib/geographer/us/states.rb', line 130 def by_name self.names_abbreviation_map end |
#names ⇒ Object
A list of names of US States only (no territories).
22 23 24 |
# File 'lib/geographer/us/states.rb', line 22 def names self.names_with_territories - self.territories_names end |
#names_abbreviation_map ⇒ Object
An index (map) of US States and territories abbreviations and full names, keyed by the name.
117 118 119 120 |
# File 'lib/geographer/us/states.rb', line 117 def names_abbreviation_map @@names_abbreviation_map ||= self.abbreviations_name_map.invert return @@names_abbreviation_map end |
#names_with_territories ⇒ Object
A list of names of US States and territories.
34 35 36 |
# File 'lib/geographer/us/states.rb', line 34 def names_with_territories self.abbreviations_name_map.values.sort end |
#territories_abbreviations ⇒ Object
A list of abbreviatons of US territories.
40 41 42 |
# File 'lib/geographer/us/states.rb', line 40 def territories_abbreviations %w( AS FM GU MH PW PR VI ) end |
#territories_names ⇒ Object
44 45 46 |
# File 'lib/geographer/us/states.rb', line 44 def territories_names [ "American Samoa", "Guam", "Islands", "Micronesia", "Palau", "Puerto Rico", "Virgin Island" ] end |