Sha256: 38119764e9a6bf402120e0f096f6dc1427b6156e4fc0fd947a33bc8bd3a50967

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

AutomobileMake.class_eval do
  data_miner do
    process "Start from scratch" do
      delete_all
    end
    
    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
      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

3 entries across 3 versions & 1 rubygems

Version Path
earth-0.12.3 lib/earth/automobile/automobile_make/data_miner.rb
earth-0.12.2 lib/earth/automobile/automobile_make/data_miner.rb
earth-0.12.1 lib/earth/automobile/automobile_make/data_miner.rb