class Alimento
Attributes
azucar[R]
carbs[R]
grasas[R]
grsat[R]
nombre[R]
protein[R]
sal[R]
Public Class Methods
new(nombre, grasas, grsat, carbs, azucar, protein, sal)
click to toggle source
# File lib/NutrientesEdu/NutrientesEdu.rb, line 9 def initialize(nombre, grasas, grsat, carbs, azucar, protein, sal) @nombre = nombre @grasas = grasas @grsat = grsat @carbs = carbs @azucar = azucar @protein = protein @sal = sal end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/NutrientesEdu/NutrientesEdu.rb, line 30 def <=> (other) val_ener <=> other.val_ener end
to_s()
click to toggle source
# File lib/NutrientesEdu/NutrientesEdu.rb, line 25 def to_s "Nombre: #{@nombre}, Grasas: #{@grasas}, Saturadas: #{@grsat}, Carbohidratos: #{@carbs}, Azucar: #{@azucar}, Proteinas: #{@protein}, Sal: #{@sal} Kcal: #{val_ener} " end
val_ener()
click to toggle source
# File lib/NutrientesEdu/NutrientesEdu.rb, line 20 def val_ener (grasas*9+carbs*4+protein*4) end