automobile_trip 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/automobile_trip.rb +1 -11
 - data/lib/automobile_trip/carbon_model.rb +8 -9
 - metadata +3 -3
 
    
        data/lib/automobile_trip.rb
    CHANGED
    
    | 
         @@ -3,15 +3,5 @@ require 'emitter' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module BrighterPlanet
         
     | 
| 
       4 
4 
     | 
    
         
             
              module AutomobileTrip
         
     | 
| 
       5 
5 
     | 
    
         
             
                extend BrighterPlanet::Emitter
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def self.automobile_trip_model
         
     | 
| 
       8 
     | 
    
         
            -
                  if Object.const_defined? 'AutomobileTrip'
         
     | 
| 
       9 
     | 
    
         
            -
                    ::AutomobileTrip
         
     | 
| 
       10 
     | 
    
         
            -
                  elsif Object.const_defined? 'AutomobileTripRecord'
         
     | 
| 
       11 
     | 
    
         
            -
                    AutomobileTripRecord
         
     | 
| 
       12 
     | 
    
         
            -
                  else
         
     | 
| 
       13 
     | 
    
         
            -
                    raise 'There is no automobile trip model'
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
       16 
6 
     | 
    
         
             
              end
         
     | 
| 
       17 
     | 
    
         
            -
            end
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -7,12 +7,11 @@ module BrighterPlanet 
     | 
|
| 
       7 
7 
     | 
    
         
             
                  def self.included(base)
         
     | 
| 
       8 
8 
     | 
    
         
             
                    base.extend ::Leap::Subject
         
     | 
| 
       9 
9 
     | 
    
         
             
                    base.decide :emission, :with => :characteristics do
         
     | 
| 
       10 
     | 
    
         
            -
                      
         
     | 
| 
       11 
10 
     | 
    
         
             
                      committee :emission do
         
     | 
| 
       12 
11 
     | 
    
         
             
                        quorum 'from fuel consumed and emission factor' do
         
     | 
| 
       13 
12 
     | 
    
         
             
                        #, :needs => [:fuel_consumed, :emission_factor] do |characteristics|
         
     | 
| 
       14 
13 
     | 
    
         
             
            #              characteristics[:fuel_consumed] * characteristics[:emission_factor]
         
     | 
| 
       15 
     | 
    
         
            -
                          16
         
     | 
| 
      
 14 
     | 
    
         
            +
                          16.0
         
     | 
| 
       16 
15 
     | 
    
         
             
                        end
         
     | 
| 
       17 
16 
     | 
    
         | 
| 
       18 
17 
     | 
    
         
             
                        quorum 'default' do
         
     | 
| 
         @@ -22,21 +21,21 @@ module BrighterPlanet 
     | 
|
| 
       22 
21 
     | 
    
         | 
| 
       23 
22 
     | 
    
         
             
                      committee :emission_factor do
         
     | 
| 
       24 
23 
     | 
    
         
             
                        quorum 'from fuel type', :needs => :fuel_type do |characteristics|
         
     | 
| 
       25 
     | 
    
         
            -
                          characteristics[:fuel_type].emission_factor
         
     | 
| 
      
 24 
     | 
    
         
            +
            #              characteristics[:fuel_type].emission_factor
         
     | 
| 
       26 
25 
     | 
    
         
             
                        end
         
     | 
| 
       27 
26 
     | 
    
         | 
| 
       28 
27 
     | 
    
         
             
                        quorum 'default' do
         
     | 
| 
       29 
     | 
    
         
            -
                          AutomobileTrip.fallback.emission_factor
         
     | 
| 
      
 28 
     | 
    
         
            +
            #              AutomobileTrip.fallback.emission_factor
         
     | 
| 
       30 
29 
     | 
    
         
             
                        end
         
     | 
| 
       31 
30 
     | 
    
         
             
                      end
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
32 
     | 
    
         
             
                      committee :fuel_consumed do
         
     | 
| 
       34 
33 
     | 
    
         
             
                        quorum 'from fuel cost and fuel price' do
         
     | 
| 
       35 
     | 
    
         
            -
                          fuel_cost / fuel_price
         
     | 
| 
      
 34 
     | 
    
         
            +
            #              fuel_cost / fuel_price
         
     | 
| 
       36 
35 
     | 
    
         
             
                        end
         
     | 
| 
       37 
36 
     | 
    
         | 
| 
       38 
37 
     | 
    
         
             
                        quorum 'from distance and fuel efficiency', :needs => [:distance, :average_fuel_efficiency] do |characteristics|
         
     | 
| 
       39 
     | 
    
         
            -
                          characteristics[:distance] / characteristics[:average_fuel_efficiency]
         
     | 
| 
      
 38 
     | 
    
         
            +
            #              characteristics[:distance] / characteristics[:average_fuel_efficiency]
         
     | 
| 
       40 
39 
     | 
    
         
             
                        end
         
     | 
| 
       41 
40 
     | 
    
         
             
                      end
         
     | 
| 
       42 
41 
     | 
    
         | 
| 
         @@ -52,11 +51,11 @@ module BrighterPlanet 
     | 
|
| 
       52 
51 
     | 
    
         | 
| 
       53 
52 
     | 
    
         
             
                      committee :distance do
         
     | 
| 
       54 
53 
     | 
    
         
             
                        quorum 'from duration and speed' do
         
     | 
| 
       55 
     | 
    
         
            -
                          duration * speed
         
     | 
| 
      
 54 
     | 
    
         
            +
            #              duration * speed
         
     | 
| 
       56 
55 
     | 
    
         
             
                        end
         
     | 
| 
       57 
56 
     | 
    
         
             
                      end
         
     | 
| 
       58 
57 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                       
     | 
| 
      
 58 
     | 
    
         
            +
                      committee :average_fuel_efficiency do
         
     | 
| 
       60 
59 
     | 
    
         
             
                        quorum 'from variant' do # variant includes make, year, and model
         
     | 
| 
       61 
60 
     | 
    
         
             
                        end
         
     | 
| 
       62 
61 
     | 
    
         | 
| 
         @@ -81,7 +80,7 @@ module BrighterPlanet 
     | 
|
| 
       81 
80 
     | 
    
         
             
                        end
         
     | 
| 
       82 
81 
     | 
    
         | 
| 
       83 
82 
     | 
    
         
             
                        quorum 'default' do
         
     | 
| 
       84 
     | 
    
         
            -
                          AutomobileTrip.fallback.fuel_type
         
     | 
| 
      
 83 
     | 
    
         
            +
            #              AutomobileTrip.fallback.fuel_type
         
     | 
| 
       85 
84 
     | 
    
         
             
                        end
         
     | 
| 
       86 
85 
     | 
    
         
             
                      end
         
     | 
| 
       87 
86 
     | 
    
         
             
                    end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: automobile_trip
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 25
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 0
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 3
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Andy Rossmeissl
         
     |