Sha256: 8ad6547fda42fb4cfd3086f7ac9b56e361a5123f2329148966a1f06bec790afc

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

class ShipmentMode < ActiveRecord::Base
  self.primary_key = "name"
  
  has_many :carrier_modes, :foreign_key => 'mode_name', :primary_key => 'name'
  
  col :name
  col :route_inefficiency_factor, :type => :float
  col :transport_emission_factor, :type => :float
  col :transport_emission_factor_units
  
  # verify "Route inefficiency factor should be one or more" do
  #   ShipmentMode.all.each do |mode|
  #     unless mode.route_inefficiency_factor >= 1.0
  #       raise "Invalid route inefficiency factor for ShipmentMode #{mode.name}: #{mode.route_inefficiency_factor} (should be >= 1.0)"
  #     end
  #   end
  # end
  # 
  # verify "Transport emission factor should be greater than zero" do
  #   ShipmentMode.all.each do |mode|
  #     unless mode.transport_emission_factor > 0
  #       raise "Invalid transport emission factor for ShipmentMode #{mode.name}: #{mode.transport_emission_factor} (should be > 0)"
  #     end
  #   end
  # end
  # 
  # verify "Transport emission factor units should never be missing" do
  #   ShipmentMode.all.each do |mode|
  #     unless mode.transport_emission_factor_units.present?
  #       raise "Missing transport emission factor units for ShipmentMode #{mode.name}"
  #     end
  #   end
  # end
  

  warn_unless_size 3
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
earth-0.12.4 lib/earth/shipping/shipment_mode.rb
earth-0.12.3 lib/earth/shipping/shipment_mode.rb
earth-0.12.2 lib/earth/shipping/shipment_mode.rb
earth-0.12.1 lib/earth/shipping/shipment_mode.rb
earth-0.12.0 lib/earth/shipping/shipment_mode.rb