Sha256: dacbc36bb2f6c64a053ffe7c0007384440d385ec80d0d3e0665b8ea96aa66eef

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

require 'earth/fuel'
# Not yet in use - for if we want to autocaculate size class stuf - November 10, 2011
class AutomobileSizeClassYear < ActiveRecord::Base
  set_primary_key :name

  col :name
  col :size_class_name
  col :year, :type => :integer
  col :type_name
  col :fuel_efficiency_city, :type => :float
  col :fuel_efficiency_city_units
  col :fuel_efficiency_highway, :type => :float
  col :fuel_efficiency_highway_units
  
  # verify "Year should be from 1975 to 2010" do
  #   AutomobileSizeClassYear.all.each do |record|
  #     unless record.year > 1974 and record.year < 2011
  #       raise "Invalid year for AutomobileSizeClassYear #{record.name}: #{record.year} (should be from 1975 to 2010)"
  #     end
  #   end
  # end
  # 
  # verify "Fuel efficiencies should be greater than zero" do
  #   AutomobileSizeClassYear.all.each do |year|
  #     %w{ fuel_efficiency_city fuel_efficiency_highway }.each do |attribute|
  #       value = year.send(:"#{attribute}")
  #       unless value > 0
  #         raise "Invalid #{attribute} for AutomobileSizeClassYear #{year.name}: #{value} (should be > 0)"
  #       end
  #     end
  #   end
  # end
  # 
  # verify "Fuel efficiency units should be kilometres per litre" do
  #   AutomobileSizeClassYear.all.each do |year|
  #     %w{ fuel_efficiency_city_units fuel_efficiency_highway_units }.each do |attribute|
  #       value = year.send(:"#{attribute}")
  #       unless value == "kilometres_per_litre"
  #         raise "Invalid #{attribute} for AutomobileSizeClassYear #{year.name}: #{value} (should be kilometres_per_litre)"
  #       end
  #     end
  #   end
  # end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
earth-0.11.10 lib/earth/automobile/automobile_size_class_year.rb
earth-0.11.9 lib/earth/automobile/automobile_size_class_year.rb
earth-0.11.8 lib/earth/automobile/automobile_size_class_year.rb