lib/motorcycle/carbon_model.rb in motorcycle-0.0.9 vs lib/motorcycle/carbon_model.rb in motorcycle-0.0.10
- old
+ new
@@ -1,12 +1,9 @@
-require 'leap'
-
module BrighterPlanet
module Motorcycle
module CarbonModel
def self.included(base)
- base.extend ::Leap::Subject
base.decide :emission, :with => :characteristics do
committee :emission do # kg CO2
quorum 'from fuel', :needs => [:fuel_consumed, :emission_factor] do |characteristics|
characteristics[:fuel_consumed] * characteristics[:emission_factor]
end
@@ -30,11 +27,11 @@
end
end
committee :fuel_efficiency do # km per litre
quorum 'default' do
- Motorcycle.motorcycle_model.fallback.fuel_efficiency
+ base.fallback.fuel_efficiency
end
end
committee :fuel_type do
quorum 'default' do
@@ -50,10 +47,10 @@
quorum 'from weekly distance estimate', :needs => :weekly_distance_estimate do |characteristics, timeframe|
(characteristics[:weekly_distance_estimate] / 7 ) * timeframe.year.days
end
quorum 'default' do
- Motorcycle.motorcycle_model.fallback.annual_distance_estimate
+ base.fallback.annual_distance_estimate
end
end
committee :active_subtimeframe do
quorum 'from acquisition and retirement', :needs => [:acquisition, :retirement] do |characteristics, timeframe|