Method: USGeo::Region.load!

Defined in:
lib/us_geo/region.rb

.load!(uri = nil) ⇒ Object



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

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

  import! do
    load_data_file(location) do |row|
      load_record!(id: row["ID"]) do |record|
        record.name = row["Name"]
        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