rail_trip 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,10 +2,12 @@ Feature: Rail Trip Committee Calculations
|
|
2
2
|
The rail trip model should generate correct committee calculations
|
3
3
|
|
4
4
|
Scenario Outline: Distance committee
|
5
|
-
Given a rail trip
|
6
|
-
And
|
7
|
-
|
8
|
-
|
5
|
+
Given a rail trip emitter
|
6
|
+
And a characteristic "rail_class.name" of "<rail_class>"
|
7
|
+
And a characteristic "duration" of "<duration>"
|
8
|
+
When the "speed" committee is calculated
|
9
|
+
And the "distance" committee is calculated
|
10
|
+
Then the conclusion of the committee should be "<distance>"
|
9
11
|
Examples:
|
10
12
|
| rail_class | duration | distance |
|
11
13
|
| commuter rail | 50 | 2542 |
|
@@ -5,7 +5,7 @@ Feature: Rail Trip Emissions Calculations
|
|
5
5
|
Given a rail trip has "rail_class.name" of "<rail_class>"
|
6
6
|
And it has "distance_estimate" of "<distance>"
|
7
7
|
When emissions are calculated
|
8
|
-
Then the emission value should be within 0.1 kgs of <emission>
|
8
|
+
Then the emission value should be within "0.1" kgs of "<emission>"
|
9
9
|
Examples:
|
10
10
|
| rail_class | distance | emission |
|
11
11
|
| commuter rail | 50 | 13.9 |
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# Rail trip's carbon model is implemented using a domain-specific language
|
2
2
|
# provided by [Leap](http://github.com/rossmeissl/leap).
|
3
|
-
require 'leap'
|
4
|
-
|
5
3
|
module BrighterPlanet
|
6
4
|
module RailTrip
|
7
5
|
|
@@ -24,7 +22,6 @@ module BrighterPlanet
|
|
24
22
|
module CarbonModel
|
25
23
|
def self.included(base)
|
26
24
|
##### The carbon model
|
27
|
-
base.extend ::Leap::Subject
|
28
25
|
|
29
26
|
# This `decide` block encapsulates the carbon model. The carbon model is
|
30
27
|
# executed with a set of "characteristics" as input. These characteristics are
|
@@ -41,7 +38,7 @@ module BrighterPlanet
|
|
41
38
|
# to obtain a per-passenger emission share.
|
42
39
|
quorum 'from fuel and passengers', :needs => [:diesel_consumed, :electricity_used, :passengers] do |characteristics|
|
43
40
|
#(( litres diesel ) * ( kilograms CO2 / litre diesel ) + ( kwH ) * ( kilograms CO2 / kWh ))
|
44
|
-
(characteristics[:diesel_consumed] *
|
41
|
+
(characteristics[:diesel_consumed] * base.research(:diesel_emission_factor) + characteristics[:electricity_used] * RailTrip.rail_trip_model.research(:electricity_emission_factor)) / characteristics[:passengers]
|
45
42
|
end
|
46
43
|
end
|
47
44
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# Rail trip's characterization is implemented using a domain-specific language
|
2
2
|
# provided by [Characterizable](http://github.com/seamusabshere/characterizable).
|
3
|
-
require 'characterizable'
|
4
|
-
|
5
3
|
module BrighterPlanet
|
6
4
|
module RailTrip
|
7
5
|
|
@@ -18,7 +16,6 @@ module BrighterPlanet
|
|
18
16
|
module Characterization
|
19
17
|
def self.included(base)
|
20
18
|
##### The characterization
|
21
|
-
base.send :include, Characterizable
|
22
19
|
|
23
20
|
# This `characterize` block encapsulates the characterization. Typically
|
24
21
|
# emitter models will be backed by ActiveRecord, which will provide
|
@@ -31,7 +28,6 @@ module BrighterPlanet
|
|
31
28
|
end
|
32
29
|
|
33
30
|
# Additional characteristics are gleaned from the carbon model.
|
34
|
-
base.add_implicit_characteristics
|
35
31
|
end
|
36
32
|
end
|
37
33
|
end
|
data/lib/rail_trip/data.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# Rail trip's summarization strategy is implemented using a domain-specific language
|
2
2
|
# provided by [Summary Judgement](http://github.com/rossmeissl/summary_judgement).
|
3
|
-
require 'summary_judgement'
|
4
|
-
|
5
3
|
module BrighterPlanet
|
6
4
|
module RailTrip
|
7
5
|
|
@@ -18,7 +16,6 @@ module BrighterPlanet
|
|
18
16
|
module Summarization
|
19
17
|
def self.included(base)
|
20
18
|
##### The carbon model
|
21
|
-
base.extend SummaryJudgement
|
22
19
|
|
23
20
|
# This `summarize` block encapsulates the summarization strategy, including
|
24
21
|
# terminology and inflection preference.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rail_trip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|
@@ -19,48 +19,46 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2010-09-
|
22
|
+
date: 2010-09-22 00:00:00 -04:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
|
26
|
+
type: :development
|
27
27
|
prerelease: false
|
28
|
-
|
28
|
+
name: activerecord
|
29
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
29
30
|
none: false
|
30
31
|
requirements:
|
31
|
-
- -
|
32
|
+
- - ~>
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
hash:
|
34
|
+
hash: 7
|
34
35
|
segments:
|
35
36
|
- 3
|
36
37
|
- 0
|
37
38
|
- 0
|
38
|
-
|
39
|
-
|
40
|
-
type: :development
|
41
|
-
version_requirements: *id001
|
39
|
+
version: 3.0.0
|
40
|
+
requirement: *id001
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
|
-
|
42
|
+
type: :development
|
44
43
|
prerelease: false
|
45
|
-
|
44
|
+
name: bundler
|
45
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
46
46
|
none: false
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ~>
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
hash:
|
50
|
+
hash: 23
|
51
51
|
segments:
|
52
52
|
- 1
|
53
53
|
- 0
|
54
54
|
- 0
|
55
|
-
|
56
|
-
|
57
|
-
version: 1.0.0.beta.2
|
58
|
-
type: :development
|
59
|
-
version_requirements: *id002
|
55
|
+
version: 1.0.0
|
56
|
+
requirement: *id002
|
60
57
|
- !ruby/object:Gem::Dependency
|
61
|
-
|
58
|
+
type: :development
|
62
59
|
prerelease: false
|
63
|
-
|
60
|
+
name: cucumber
|
61
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
64
62
|
none: false
|
65
63
|
requirements:
|
66
64
|
- - "="
|
@@ -71,12 +69,12 @@ dependencies:
|
|
71
69
|
- 8
|
72
70
|
- 3
|
73
71
|
version: 0.8.3
|
74
|
-
|
75
|
-
version_requirements: *id003
|
72
|
+
requirement: *id003
|
76
73
|
- !ruby/object:Gem::Dependency
|
77
|
-
|
74
|
+
type: :development
|
78
75
|
prerelease: false
|
79
|
-
|
76
|
+
name: jeweler
|
77
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
80
78
|
none: false
|
81
79
|
requirements:
|
82
80
|
- - "="
|
@@ -87,12 +85,12 @@ dependencies:
|
|
87
85
|
- 4
|
88
86
|
- 0
|
89
87
|
version: 1.4.0
|
90
|
-
|
91
|
-
version_requirements: *id004
|
88
|
+
requirement: *id004
|
92
89
|
- !ruby/object:Gem::Dependency
|
93
|
-
|
90
|
+
type: :development
|
94
91
|
prerelease: false
|
95
|
-
|
92
|
+
name: rake
|
93
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
96
94
|
none: false
|
97
95
|
requirements:
|
98
96
|
- - ">="
|
@@ -101,12 +99,12 @@ dependencies:
|
|
101
99
|
segments:
|
102
100
|
- 0
|
103
101
|
version: "0"
|
104
|
-
|
105
|
-
version_requirements: *id005
|
102
|
+
requirement: *id005
|
106
103
|
- !ruby/object:Gem::Dependency
|
107
|
-
|
104
|
+
type: :development
|
108
105
|
prerelease: false
|
109
|
-
|
106
|
+
name: rdoc
|
107
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
110
108
|
none: false
|
111
109
|
requirements:
|
112
110
|
- - ">="
|
@@ -115,12 +113,12 @@ dependencies:
|
|
115
113
|
segments:
|
116
114
|
- 0
|
117
115
|
version: "0"
|
118
|
-
|
119
|
-
version_requirements: *id006
|
116
|
+
requirement: *id006
|
120
117
|
- !ruby/object:Gem::Dependency
|
121
|
-
|
118
|
+
type: :development
|
122
119
|
prerelease: false
|
123
|
-
|
120
|
+
name: rspec
|
121
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
124
122
|
none: false
|
125
123
|
requirements:
|
126
124
|
- - "="
|
@@ -133,12 +131,12 @@ dependencies:
|
|
133
131
|
- beta
|
134
132
|
- 17
|
135
133
|
version: 2.0.0.beta.17
|
136
|
-
|
137
|
-
version_requirements: *id007
|
134
|
+
requirement: *id007
|
138
135
|
- !ruby/object:Gem::Dependency
|
139
|
-
|
136
|
+
type: :development
|
140
137
|
prerelease: false
|
141
|
-
|
138
|
+
name: sniff
|
139
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
142
140
|
none: false
|
143
141
|
requirements:
|
144
142
|
- - ~>
|
@@ -149,24 +147,23 @@ dependencies:
|
|
149
147
|
- 1
|
150
148
|
- 10
|
151
149
|
version: 0.1.10
|
152
|
-
|
153
|
-
version_requirements: *id008
|
150
|
+
requirement: *id008
|
154
151
|
- !ruby/object:Gem::Dependency
|
155
|
-
|
152
|
+
type: :runtime
|
156
153
|
prerelease: false
|
157
|
-
|
154
|
+
name: emitter
|
155
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
158
156
|
none: false
|
159
157
|
requirements:
|
160
158
|
- - ~>
|
161
159
|
- !ruby/object:Gem::Version
|
162
|
-
hash:
|
160
|
+
hash: 19
|
163
161
|
segments:
|
164
162
|
- 0
|
165
|
-
-
|
166
|
-
-
|
167
|
-
version: 0.
|
168
|
-
|
169
|
-
version_requirements: *id009
|
163
|
+
- 1
|
164
|
+
- 4
|
165
|
+
version: 0.1.4
|
166
|
+
requirement: *id009
|
170
167
|
description: A software model in Ruby for the greenhouse gas emissions of an rail_trip
|
171
168
|
email: andy@rossmeissl.net
|
172
169
|
executables: []
|