class USGeo::State

U.S. state or territory.

Constants

DISTRICT_TYPE
STATE_TYPE
TERRITORY_TYPE

Public Class Methods

load!(uri = nil) click to toggle source
# File lib/us_geo/state.rb, line 26
def load!(uri = nil)
  location = data_uri(uri || "states.csv")
  
  import! do
    load_data_file(location) do |row|
      load_record!(code: row["Code"]) do |record|
        record.name = row["Name"]
        record.type = row["Type"]
        record.fips = row["FIPS"]
        record.region_id = row["Region ID"]
        record.division_id = row["Division ID"]
      end
    end
  end
end

Public Instance Methods

district?() click to toggle source
# File lib/us_geo/state.rb, line 51
def district?
  type == DISTRICT_TYPE
end
state?() click to toggle source
# File lib/us_geo/state.rb, line 43
def state?
  type == STATE_TYPE
end
territory?() click to toggle source
# File lib/us_geo/state.rb, line 47
def territory?
  type == TERRITORY_TYPE
end