Sha256: d426951d25939b9312290e1de515f4d7d88d429d533e5bc7758e374e6ef1759d

Contents?: true

Size: 771 Bytes

Versions: 11

Compression:

Stored size: 771 Bytes

Contents

require 'rail_trip'

class RailTripRecord < ActiveRecord::Base
  include Sniff::Emitter
  include BrighterPlanet::RailTrip
  belongs_to :rail_class
    
  conversion_accessor :distance_estimate, :external => :miles, :internal => :kilometres
  
  falls_back_on
  
  class << self
    def research(key)
      case key
      when :diesel_emission_factor
        22.59.pounds_per_gallon.to(:kilograms_per_litre) # CO2 / diesel  https://brighterplanet.sifterapp.com/projects/30/issues/455
      when :electricity_emission_factor
        1.36.pounds.to(:kilograms) # CO2 / kWh https://brighterplanet.sifterapp.com/projects/30/issues/455
      end
    end
  end
  
  def emission_date
    created_at.to_date #FIXME we should add a date characteristic for this emitter
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rail_trip-0.0.12 lib/test_support/rail_trip_record.rb
rail_trip-0.0.11 lib/test_support/rail_trip_record.rb
rail_trip-0.0.10 lib/test_support/rail_trip_record.rb
rail_trip-0.0.9 lib/test_support/rail_trip_record.rb
rail_trip-0.0.8 lib/test_support/rail_trip_record.rb
rail_trip-0.0.7 lib/test_support/rail_trip_record.rb
rail_trip-0.0.6 lib/test_support/rail_trip_record.rb
rail_trip-0.0.5 lib/test_support/rail_trip_record.rb
rail_trip-0.0.4 lib/test_support/rail_trip_record.rb
rail_trip-0.0.3 lib/test_support/rail_trip_record.rb
rail_trip-0.0.2 lib/test_support/rail_trip_record.rb