Class: Concensus::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/concensus/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.


33
34
35
36
37
38
39
40
41
# File 'lib/concensus/configuration.rb', line 33

def initialize
  @year = 2010
  
  @tmp_dir = @default_tmp_dir = "#{Dir.home()}/.concensus/tmp/"
  FileUtils.mkdir_p(@tmp_dir)
  
  # Not really sure what the Census' IT department was going for with this number system.
  @census_state_ids = { "AL"=>"01","AK"=>"02","AZ"=>"04","AR"=>"05","CA"=>"06","CO"=>"08","CT"=>"09","DE"=>"10","DC"=>"11","FL"=>"12","GA"=>"13","HI"=>"15","ID"=>"16","IL"=>"17","IN"=>"18","IA"=>"19","KS"=>"20","KY"=>"21","LA"=>"22","ME"=>"23","MD"=>"24","MA"=>"25","MI"=>"26","MN"=>"27","MS"=>"28","MO"=>"29","MT"=>"30","NE"=>"31","NV"=>"32","NH"=>"33","NJ"=>"34","NM"=>"35","NY"=>"36","NC"=>"37","ND"=>"38","OH"=>"39","OK"=>"40","OR"=>"41","PA"=>"42","RI"=>"44","SC"=>"45","SD"=>"46","TN"=>"47","TX"=>"48","UT"=>"49","VT"=>"50","VA"=>"51","WA"=>"53","WV"=>"54","WI"=>"55","WY"=>"56","AS"=>"60","GU"=>"66","MP"=>"69","PR"=>"72","VI"=>"78" }
end

Instance Attribute Details

#census_state_idsObject (readonly)

Returns the value of attribute census_state_ids


3
4
5
# File 'lib/concensus/configuration.rb', line 3

def census_state_ids
  @census_state_ids
end

#default_tmp_dirObject (readonly)

Returns the value of attribute default_tmp_dir


3
4
5
# File 'lib/concensus/configuration.rb', line 3

def default_tmp_dir
  @default_tmp_dir
end

#tmp_dirObject

Returns the value of attribute tmp_dir


3
4
5
# File 'lib/concensus/configuration.rb', line 3

def tmp_dir
  @tmp_dir
end

#yearObject

Returns the value of attribute year


3
4
5
# File 'lib/concensus/configuration.rb', line 3

def year
  @year
end

Instance Method Details

#root_urlObject

This will become useful once we can switch years…


25
26
27
# File 'lib/concensus/configuration.rb', line 25

def root_url
  "http://www2.census.gov/geo/tiger/TIGER#{@year}/"
end

#short_yearObject


29
30
31
# File 'lib/concensus/configuration.rb', line 29

def short_year
  @year.to_s[-2, 2]
end