Class: Concensus::State
Instance Attribute Summary
Attributes inherited from Resource
#geometry, #name, #state, #year
Class Method Summary collapse
-
.find(state) ⇒ Concensus::Resource
Matched state.
-
.find_all ⇒ Array
All states.
Methods inherited from Resource
already_unzipped?, file_extension, filename_without_extension, get_and_unzip, #initialize, process_find, state_code_to_id
Constructor Details
This class inherits a constructor from Concensus::Resource
Class Method Details
.find(state) ⇒ Concensus::Resource
Returns matched state.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/concensus/state.rb', line 5 def self.find(state) if Concensus::configuration.year == 2010 shp_file_path = get_and_unzip("STATE/2010/tl_2010_#{state_code_to_id(state)}_state10.zip") return process_find("State", shp_file_path, "NAME10", state)[0] else raise NoResourceForYear end end |
.find_all ⇒ Array
Returns all states.
17 18 19 20 21 22 23 |
# File 'lib/concensus/state.rb', line 17 def self.find_all shapes = [] Concensus::configuration.census_state_ids.each do |state_code, _| shapes << find(state_code) end return shapes end |