Module: USNO::Transit::States

Defined in:
lib/usno/transit/states.rb

Class Method Summary collapse

Class Method Details

.by_key_or_value(kv) ⇒ Object



28
29
30
31
# File 'lib/usno/transit/states.rb', line 28

def self.by_key_or_value(kv)
  states.has_value? kv and return kv
  states.fetch(kv) { raise "USNO State not recognized" }
end

.statesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/usno/transit/states.rb', line 4

def self.states
  {
    "Alabama"              => "AL", "Alaska"         => "AK", "American Samoa" => "AS",
    "Arizona"              => "AZ", "Arkansas"       => "AR", "California"     => "CA",
    "Colorado"             => "CO", "Connecticut"    => "CT", "Delaware"       => "DE",
    "District of Columbia" => "DC", "Florida"        => "FL", "Georgia"        => "GA",
    "Guam"                 => "GU", "Hawaii"         => "HI", "Idaho"          => "ID",
    "Indiana"              => "IN", "Iowa"           => "IA", "Kansas"         => "KS",
    "Kentucky"             => "KY", "Louisiana"      => "LA", "Maine"          => "ME",
    "Maryland"             => "MD", "Massachusetts"  => "MA", "Michigan"       => "MI",
    "Minnesota"            => "MN", "Mississippi"    => "MS", "Missouri"       => "MO",
    "Montana"              => "MT", "Nebraska"       => "NE", "Nevada"         => "NV",
    "New Hampshire"        => "NH", "New Jersey"     => "NJ", "New Mexico"     => "NM",
    "New York"             => "NY", "North Carolina" => "NC", "North Dakota"   => "ND",
    "N. Mariana Islands"   => "MP", "Ohio"           => "OH", "Oklahoma"       => "OK",
    "Oregon"               => "OR", "Pennsylvania"   => "PA", "Puerto Rico"    => "PR",
    "Rhode Island"         => "RI", "South Carolina" => "SC", "South Dakota"   => "SD",
    "Tennessee"            => "TN", "Texas"          => "TX", "Utah"           => "UT",
    "Vermont"              => "VT", "Virgin Islands" => "VI", "Virginia"       => "VA",
    "Washington"           => "WA", "West Virginia"  => "WV", "Wisconsin"      => "WI",
    "Wyoming"              => "WY", "Illinois"       => "IL"
  }
end