9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/automobile_trip/carbon_model.rb', line 9
def self.included(base)
base.decide :emission, :with => :characteristics do
committee :emission do quorum 'from fuel use and emission factor', :needs => [:fuel_use, :emission_factor] do |characteristics|
characteristics[:fuel_use] * characteristics[:emission_factor]
end
quorum 'default' do
raise "The emission committee's default quorum should never be called"
end
end
committee :emission_factor do quorum 'from fuel type', :needs => :fuel_type do |characteristics|
characteristics[:fuel_type].emission_factor
end
quorum 'default' do
base.fallback.emission_factor
end
end
committee :fuel_use do quorum 'default' do
base.fallback.fuel_use
end
end
end
end
|