Class: BrighterPlanet::Flight::CarbonModel::FuelUseEquation

Inherits:
Struct
  • Object
show all
Defined in:
lib/flight/carbon_model/fuel_use_equation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#endpoint_fuelObject

Returns the value of attribute endpoint_fuel

Returns:

  • (Object)

    the current value of endpoint_fuel



4
5
6
# File 'lib/flight/carbon_model/fuel_use_equation.rb', line 4

def endpoint_fuel
  @endpoint_fuel
end

#m1Object

Returns the value of attribute m1

Returns:

  • (Object)

    the current value of m1



4
5
6
# File 'lib/flight/carbon_model/fuel_use_equation.rb', line 4

def m1
  @m1
end

#m2Object

Returns the value of attribute m2

Returns:

  • (Object)

    the current value of m2



4
5
6
# File 'lib/flight/carbon_model/fuel_use_equation.rb', line 4

def m2
  @m2
end

#m3Object

Returns the value of attribute m3

Returns:

  • (Object)

    the current value of m3



4
5
6
# File 'lib/flight/carbon_model/fuel_use_equation.rb', line 4

def m3
  @m3
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/flight/carbon_model/fuel_use_equation.rb', line 5

def empty?
  values.all?(&:nil?) or values.all?(&:zero?)
end

#to_xml(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/flight/carbon_model/fuel_use_equation.rb', line 13

def to_xml(options = {})
  options[:indent] ||= 2
  xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
  xml.instruct! unless options[:skip_instruct]
  xml.fuel_use_equation do |estimate_block|
    estimate_block.endpoint_fuel endpoint_fuel, :type => 'float'
    estimate_block.m1 m1, :type => 'float'
    estimate_block.m2 m2, :type => 'float'
    estimate_block.m3 m3, :type => 'float'
  end
end

#valuesObject



9
10
11
# File 'lib/flight/carbon_model/fuel_use_equation.rb', line 9

def values
  [m3, m2, m1, endpoint_fuel]
end