Sha256: bc9a724ae817b4e93ed8c32a904396fb2fcab0c1565d8a480f10da27bd314940

Contents?: true

Size: 946 Bytes

Versions: 9

Compression:

Stored size: 946 Bytes

Contents

class FuelType < ActiveRecord::Base
  set_primary_key :name
  
  has_many :prices, :class_name => 'FuelPrice', :foreign_key => 'name' # weird
  
  falls_back_on :emission_factor               => 1.0, #FIXME TODO put a real value here - also do we want to do emission factors in kg / kj?
                :emission_factor_units         => 'FIXME',
                :average_purchase_volume       => 100, #FIXME TODO put a real value here - also do we want to do volumes in kJ?
                :average_purchase_volume_units => 'FIXME'
  
  def price
    prices.average :price
  end
  
  col :name
  col :emission_factor, :type => :float
  col :emission_factor_units
  col :density, :type => :float
  col :density_units
  col :average_purchase_volume, :type => :float
  col :average_purchase_volume_units
  # col :energy_content, :type => :float
  # col :energy_content_units
  # col :carbon_content, :type => :float
  # col :carbon_content_units
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
earth-0.11.0 lib/earth/fuel/fuel_type.rb
earth-0.7.0 lib/earth/fuel/fuel_type.rb
earth-0.6.6 lib/earth/fuel/fuel_type.rb
earth-0.6.5 lib/earth/fuel/fuel_type.rb
earth-0.6.4 lib/earth/fuel/fuel_type.rb
earth-0.6.3 lib/earth/fuel/fuel_type.rb
earth-0.6.2 lib/earth/fuel/fuel_type.rb
earth-0.6.1 lib/earth/fuel/fuel_type.rb
earth-0.6.0 lib/earth/fuel/fuel_type.rb