Sha256: d30d78e9a1ac80efdc23af327a952f7a990783705c8aba093a118aeeedc5abef

Contents?: true

Size: 864 Bytes

Versions: 8

Compression:

Stored size: 864 Bytes

Contents

AutomobileMakeYearFleet.class_eval do
  data_miner do
    import "annual corporate average fuel economy data for domestic and imported vehicle fleets from the NHTSA",
           :url => "file://#{Earth::DATA_DIR}/automobile/cafe_data.csv",
           :errata => { :url => "file://#{Earth::ERRATA_DIR}/automobile_make_year_fleet/cafe_errata.csv", :encoding => 'ISO-8859-1' },
           :select => proc { |row| row['volume'].to_i > 0 } do
      key   'name', :synthesize => proc { |row| [ row['manufacturer_name'], row['year_content'], row['fleet'][2,2] ].join ' ' }
      store 'make_name', :field_name => 'manufacturer_name'
      store 'year', :field_name => 'year_content'
      store 'fleet', :chars => 2..3 # zero-based
      store 'fuel_efficiency', :from_units => :miles_per_gallon, :to_units => :kilometres_per_litre
      store 'volume'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
earth-1.2.1 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-1.1.2 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-1.1.1 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-1.1.0 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-1.0.3 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-1.0.2 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-1.0.1 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb
earth-1.0.0 lib/earth/automobile/automobile_make_year_fleet/data_miner.rb