flight 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/flight/carbon_model.rb +13 -0
  2. metadata +21 -10
@@ -3,6 +3,7 @@
3
3
  # Contact Brighter Planet for dual-license arrangements.
4
4
 
5
5
  require 'weighted_average'
6
+ require 'builder'
6
7
 
7
8
  ## Flight:carbon model
8
9
  # This module is used by [Brighter Planet](http://brighterplanet.com)'s carbon emission [web service](http://carbon.brighterplanet.com) to estimate the **greenhouse gas emissions of passenger air travel**.
@@ -521,6 +522,18 @@ module BrighterPlanet
521
522
  def empty?
522
523
  m3.nil? and m2.nil? and m1.nil? and endpoint_fuel.nil?
523
524
  end
525
+
526
+ def to_xml(options = {})
527
+ options[:indent] ||= 2
528
+ xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
529
+ xml.instruct! unless options[:skip_instruct]
530
+ xml.fuel_use_equation do |estimate_block|
531
+ estimate_block.endpoint_fuel endpoint_fuel, :type => 'float'
532
+ estimate_block.m1 m1, :type => 'float'
533
+ estimate_block.m2 m2, :type => 'float'
534
+ estimate_block.m3 m3, :type => 'float'
535
+ end
536
+ end
524
537
  end
525
538
  end
526
539
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andy Rossmeissl
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-10-28 00:00:00 -04:00
21
+ date: 2010-10-29 00:00:00 -04:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -31,8 +31,8 @@ dependencies:
31
31
  segments:
32
32
  - 3
33
33
  - 0
34
- - 0
35
- version: 3.0.0
34
+ - 1
35
+ version: 3.0.1
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: *id001
@@ -115,10 +115,8 @@ dependencies:
115
115
  segments:
116
116
  - 2
117
117
  - 0
118
- - 0
119
- - beta
120
- - 17
121
- version: 2.0.0.beta.17
118
+ - 1
119
+ version: 2.0.1
122
120
  type: :development
123
121
  prerelease: false
124
122
  version_requirements: *id007
@@ -152,6 +150,19 @@ dependencies:
152
150
  type: :runtime
153
151
  prerelease: false
154
152
  version_requirements: *id009
153
+ - !ruby/object:Gem::Dependency
154
+ name: builder
155
+ requirement: &id010 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ segments:
161
+ - 0
162
+ version: "0"
163
+ type: :runtime
164
+ prerelease: false
165
+ version_requirements: *id010
155
166
  description: A software model in Ruby for the greenhouse gas emissions of a flight
156
167
  email: andy@rossmeissl.net
157
168
  executables: []
@@ -191,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
202
  requirements:
192
203
  - - ">="
193
204
  - !ruby/object:Gem::Version
194
- hash: -903320465
205
+ hash: 1003141553
195
206
  segments:
196
207
  - 0
197
208
  version: "0"