Sha256: 8a1ef516596ce9a46576cdae752b2da63c08aa250dbeee162cf5c34bc75099d7

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 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
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
earth-0.11.20 lib/earth/shipping/shipment_mode.rb
earth-0.11.19 lib/earth/shipping/shipment_mode.rb
earth-0.11.18 lib/earth/shipping/shipment_mode.rb
earth-0.11.17 lib/earth/shipping/shipment_mode.rb
earth-0.11.16 lib/earth/shipping/shipment_mode.rb
earth-0.11.15 lib/earth/shipping/shipment_mode.rb
earth-0.11.14 lib/earth/shipping/shipment_mode.rb
earth-0.11.13 lib/earth/shipping/shipment_mode.rb
earth-0.11.12 lib/earth/shipping/shipment_mode.rb
earth-0.11.11 lib/earth/shipping/shipment_mode.rb