Class: Menu
- Inherits:
-
Lista
show all
- Includes:
- Comparable
- Defined in:
- lib/NutrientesEdu/Menu.rb
Constant Summary
Constants inherited
from Lista
Lista::VERSION
Instance Attribute Summary
Attributes inherited from Lista
#head, #tail
Instance Method Summary
collapse
Methods inherited from Lista
#each, #pop_head, #pop_tail, #push_head, #push_tail, #sort_salt, #to_s
Instance Method Details
#<=>(other) ⇒ Object
18
19
20
|
# File 'lib/NutrientesEdu/Menu.rb', line 18
def <=>(other)
kcal <=> other.kcal
end
|
#is_enough(persona) ⇒ Object
12
13
14
15
|
# File 'lib/NutrientesEdu/Menu.rb', line 12
def is_enough(persona)
x = kcal
return (persona.g_en_total <= x * 1.1) && (persona.g_en_total >= x * 0.9)
end
|
#kcal ⇒ Object
6
7
8
9
10
|
# File 'lib/NutrientesEdu/Menu.rb', line 6
def kcal
x = collect{|a| a.val_ener}
y = x.inject(0, :+)
y
end
|