Class: MenuEficiente
- Inherits:
-
Menu
- Object
- Menu
- MenuEficiente
show all
- Includes:
- Comparable
- Defined in:
- lib/menu.rb
Instance Attribute Summary collapse
Attributes inherited from Menu
#platos
Instance Method Summary
collapse
Methods inherited from Menu
#carbohidratos_porcentaje, #lipidos_porcentaje, #proteinas_porcentaje, #total_gramos, #valorCaloricoTotal
Constructor Details
Returns a new instance of MenuEficiente.
83
84
85
|
# File 'lib/menu.rb', line 83
def initialize (platos)
super(platos)
end
|
Instance Attribute Details
Returns the value of attribute tipo_menu.
81
82
83
|
# File 'lib/menu.rb', line 81
def
@tipo_menu
end
|
Instance Method Details
#<=>(another) ⇒ Object
108
109
110
|
# File 'lib/menu.rb', line 108
def <=> (another)
self.total_gases <=> another.total_gases
end
|
#to_s ⇒ Object
103
104
105
106
|
# File 'lib/menu.rb', line 103
def to_s
"Gases Totales: #{self.total_gases} kgCO2eq,\n " +
"Uso Terreno: #{self.total_terreno} m2año"
end
|
#total_gases ⇒ Object
87
88
89
90
91
92
93
|
# File 'lib/menu.rb', line 87
def total_gases
gases = 0
@platos.each do |plato|
gases += plato.gei
end
return gases
end
|
#total_terreno ⇒ Object
95
96
97
98
99
100
101
|
# File 'lib/menu.rb', line 95
def total_terreno
terreno = 0
@platos.each do |plato|
terreno += plato.terreno
end
return terreno
end
|