class Dieta
Attributes
gramos[RW]
kcal[RW]
pgh[RW]
platos[RW]
porcentaje[RW]
porcion[RW]
titulo[RW]
Public Class Methods
new(titulo, porcentaje, platos, porcion, gramos, kcal, pgh)
click to toggle source
# File lib/MenuDieta/dieta.rb, line 5 def initialize(titulo, porcentaje, platos, porcion, gramos, kcal, pgh) @titulo = titulo @porcentaje = porcentaje @platos = platos @porcion = porcion @gramos = gramos @kcal = kcal @pgh = pgh end
Public Instance Methods
<=>(anOther)
click to toggle source
# File lib/MenuDieta/dieta.rb, line 34 def <=> (anOther) self.kcal <=> anOther.kcal end
==(anOther)
click to toggle source
# File lib/MenuDieta/dieta.rb, line 38 def == (anOther) return (kcal==anOther.kcal) && (pgh == anOther.pgh) end
to_s()
click to toggle source
# File lib/MenuDieta/dieta.rb, line 15 def to_s aux = "#{titulo} (#{porcentaje})\n" i = 0 while i < @platos.size aux = aux + "- #{@platos[i]}, #{@porcion[i]}, #{@gramos[i]} g\n" i = i + 1 end aux = aux + "V.C.T. | % #{kcal} Kcal |" i = 0 while i < @pgh.size aux = aux + " #{@pgh[i]}%" if(i < @pgh.size-1) aux = aux + " -" end i = i + 1 end return aux end