Sha256: 44769eb03924a09a45bca904768328c3823751215d8ba40d036a7b6f8ca6de84
Contents?: true
Size: 753 Bytes
Versions: 1
Compression:
Stored size: 753 Bytes
Contents
class Alimento attr_reader :nombre, :prt, :gluc, :lip include Comparable def <=>(another) kcal <=> another.kcal end def initialize(nombre,prt,gluc,lip) @nombre=nombre @prt=prt @gluc=gluc @lip=lip end def to_s() "#{@nombre} prt=#{@prt}g gluc=#{@gluc}g lip=#{@lip}g" end def kcal() @prt*4+@gluc*4+@lip*9 end end class Grupoal < Alimento def initialize(grupo,nombre,prt,gluc,lip) super(nombre,prt,gluc,lip) @grupo=grupo end def to_s puts @grupo+"\n\t"+super.to_s end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alimento0100886306-0.1.0 | lib/alimento/alimento.rb |