Class: Concensus::School::Unified

Inherits:
Concensus::School show all
Defined in:
lib/concensus/school.rb

Instance Attribute Summary

Attributes inherited from Resource

#geometry, #name, #state, #year

Class Method Summary collapse

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, name = nil) ⇒ Object


41
42
43
44
45
46
47
48
49
50
51
# File 'lib/concensus/school.rb', line 41

def self.find(state, name = nil)
  if Concensus::configuration.year == 2010
    attribute_key = "NAME10"
    shp_file_path = get_and_unzip("UNSD/2010/tl_2010_#{state_code_to_id(state)}_unsd10.zip")
  elsif Concensus::configuration.year == 2011
    attribute_key = "name"
    shp_file_path = get_and_unzip("UNSD/tl_2011_#{state_code_to_id(state)}_unsd.zip")
  end
  
  return process_find("School::Unified", shp_file_path, attribute_key, state, name)  
end

.find_all(state) ⇒ Object


53
54
55
# File 'lib/concensus/school.rb', line 53

def self.find_all(state)
  find(state)       
end