Sha256: 94c9d029710c6e4f27d53cacec717bc13a326e823aebc598b2bb379d9a45e25e

Contents?: true

Size: 1.49 KB

Versions: 7

Compression:

Stored size: 1.49 KB

Contents

require 'earth/automobile/automobile_make_year'

AutomobileMake.class_eval do
  data_miner do
    process "Ensure AutomobileMakeYear is populated" do
      AutomobileMakeYear.run_data_miner!
    end
    
    process "Derive manufacturer names from AutomobileMakeYear" do
      ::Earth::Utils.insert_ignore(
        :src => AutomobileMakeYear,
        :dest => AutomobileMake,
        :cols => { :make_name => :name }
      )
    end
    
    process "Derive fuel efficiency from AutomobileMakeYear" do
      safe_find_each do |make|
        make.update_attributes!(
          :fuel_efficiency => make.make_years.weighted_average(:fuel_efficiency),
          :fuel_efficiency_units => make.make_years.first.fuel_efficiency_units
        )
      end
    end
  end
end

# leave this for later if we need it
# SUBSIDIARIES = {
#   'Chevrolet' => 'GM',
#   'Pontiac' => 'GM',
#   'Audi' => 'Volkswagen',
#   'Dodge' => 'Chrysler',
#   'Lincoln' => 'Ford',
#   'Plymouth' => 'Chrysler',
#   'Buick' => 'GM',
#   'Cadillac' => 'GM',
#   'Merkur' => 'Ford',
#   'Oldsmobile' => 'GM',
#   'GMC' => 'GM',
#   'Bentley' => 'Rolls-Royce', # currently owned by Volkswagen, but a Flying Spur is hardly a rebranded Passat
#   'Acura' => 'Honda',
#   'Land Rover' => 'Ford',
#   'Eagle' => 'Chrysler',
#   'Geo' => 'GM',
#   'Laforza' => 'Ford',
#   'Infiniti' => 'Nissan',
#   'Lexus' => 'Toyota',
#   'Saturn' => 'GM',
#   'Mercury' => 'Ford',
#   'Alpina' => 'BMW',
#   'Mini' => 'BMW',
#   'Maybach' => 'Mercedes',
#   'Hummer' => 'GM'
# }

Version data entries

7 entries across 7 versions & 1 rubygems

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