class Menu

Attributes

grasas[R]
hidratos[R]
platos[R]
porcentaje[R]
proteinas[R]
titulo[R]
vct[R]

Public Class Methods

new(titulo, porcentaje, platos, vct, proteinas, grasas, hidratos) click to toggle source
# File lib/dieta/menu.rb, line 6
def initialize titulo, porcentaje, platos, vct, proteinas, grasas, hidratos
        @titulo, @porcentaje, @platos, @vct, @proteinas, @grasas, @hidratos = titulo, porcentaje, platos, vct, proteinas, grasas, hidratos
end

Public Instance Methods

<=>(otro) click to toggle source
# File lib/dieta/menu.rb, line 39
def <=>(otro)
        titulo<=>otro.titulo
end
get_grasas() click to toggle source
# File lib/dieta/menu.rb, line 33
def get_grasas
        @grasas
end
get_hidratos() click to toggle source
# File lib/dieta/menu.rb, line 36
def get_hidratos
        @hidratos
end
get_plato(i) click to toggle source
# File lib/dieta/menu.rb, line 12
def get_plato i
        @platos[i]
end
get_porcentaje() click to toggle source
# File lib/dieta/menu.rb, line 21
def get_porcentaje
        @porcentaje
end
get_proteinas() click to toggle source
# File lib/dieta/menu.rb, line 30
def get_proteinas
        @proteinas
end
get_titulo() click to toggle source
# File lib/dieta/menu.rb, line 9
def get_titulo
        @titulo
end
get_vct() click to toggle source
# File lib/dieta/menu.rb, line 18
def get_vct
        @vct
end
getall_platos() click to toggle source
# File lib/dieta/menu.rb, line 15
def getall_platos
        @platos
end
to_s() click to toggle source
# File lib/dieta/menu.rb, line 24
def to_s
        out = "#{@titulo.upcase} (#{@porcentaje}%)\n"
        out << @platos.map { |plato| "- #{plato}" }.join(",\n")
        out << "\nV.C.T. | % #{vct} kcal | #{proteinas}% - #{grasas}% - #{hidratos}%"
        out
end