Class: USGeo::Division

Inherits:
BaseRecord
  • Object
show all
Includes:
Area, Population
Defined in:
lib/us_geo/division.rb

Overview

U.S. regional division composed of states.

Constant Summary

Constants inherited from BaseRecord

BaseRecord::STATUS_IMPORTED, BaseRecord::STATUS_MANUAL, BaseRecord::STATUS_REMOVED

Instance Attribute Summary collapse

Attributes included from Area

#land_area, #water_area

Attributes included from Population

#housing_units, #population

Attributes inherited from BaseRecord

#status, #updated_at

Class Method Summary collapse

Methods included from Area

#land_area_km, #percent_land, #total_area, #water_area_km

Methods included from Population

#housing_density, #housing_density_km, #population_density, #population_density_km

Methods inherited from BaseRecord

#imported?, #manual?, #removed?

Instance Attribute Details

#idInteger

Returns ID of the division.

Returns:

  • (Integer)

    ID of the division.



# File 'lib/us_geo/division.rb', line 14

Class Method Details

.load!(uri = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/us_geo/division.rb', line 21

def load!(uri = nil)
  location = data_uri(uri || "divisions.csv")

  import! do
    load_data_file(location) do |row|
      load_record!(id: row["ID"]) do |record|
        record.name = row["Name"]
        record.region_id = row["Region ID"]
        record.population = row["Population"]
        record.housing_units = row["Housing Units"]
        record.land_area = row["Land Area"]
        record.water_area = row["Water Area"]
      end
    end
  end
end