Sha256: 10db868a63de70c7993b86e6005ecf7a40349f68a01c7bb7bfe1f717900e40d7
Contents?: true
Size: 756 Bytes
Versions: 2
Compression:
Stored size: 756 Bytes
Contents
module FipsCountyCodes fips = {} state_county = {} LIB_DIRECTORY = File.expand_path(File.dirname(__FILE__)) FIPS_CODES_CSV_FILE = File.join(LIB_DIRECTORY, 'national.txt') File.open(FIPS_CODES_CSV_FILE) do |f| f.readline # skip the first line with headers until f.eof row = f.readline.chomp.split(',') state, state_code, county_code, county, class_code_ignored = row fips[state] = {} if not fips.member?(state) fips_code = (state_code + county_code).to_i fips[state][county] = fips_code county2 = county.gsub(' County', '') fips[state][county2] = fips_code if county != county2 state_county[fips_code] = [state, county] end end FIPS = fips STATE_COUNTY = state_county end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fips-county-codes-0.5.0 | lib/fips_county_codes.rb |
fips-county-codes-0.4.0 | lib/fips_county_codes.rb |