class Alimento::Alimento
Attributes
gluc[R]
lip[R]
nombre[R]
prt[R]
Public Class Methods
new(nombre,prt,gluc,lip)
click to toggle source
# File lib/alimento.rb, line 16 def initialize(nombre,prt,gluc,lip) @nombre=nombre @prt=prt @gluc=gluc @lip=lip end
Public Instance Methods
<=>(another)
click to toggle source
# File lib/alimento.rb, line 12 def <=>(another) kcal <=> another.kcal end
kcal()
click to toggle source
# File lib/alimento.rb, line 27 def kcal() @prt*4+@gluc*4+@lip*9 end
to_s()
click to toggle source
# File lib/alimento.rb, line 23 def to_s() "#{@nombre} prt=#{@prt}g gluc=#{@gluc}g lip=#{@lip}g" end