class Etiqueta

Constants

VERSION

Attributes

azucar[R]
carbh[R]
grasas[R]
gsat[R]
nombre[R]
protein[R]
sal[R]

Public Class Methods

new(nombre, grasas, gsat, carbh, azucar, protein, sal) click to toggle source
# File lib/alu0100987522/etiqueta.rb, line 8
def initialize(nombre, grasas, gsat, carbh, azucar, protein, sal)
  
  @nombre = nombre
  @grasas = grasas
  @gsat = gsat
  @carbh = carbh
  @azucar = azucar
  @protein = protein
  @sal = sal
  
end

Public Instance Methods

<=>(another) click to toggle source
# File lib/alu0100987522/etiqueta.rb, line 28
def <=>(another)
  val_energetico <=> another.val_energetico
end
to_s() click to toggle source
# File lib/alu0100987522/etiqueta.rb, line 24
def to_s
  return %Q"#{@nombre} --- Grasas: #{@grasas} ; Saturadas: #{@gsat} -- Hidratos de Carbono: #{@carbh} -- Azucar: #{@azucar} -- ProteĆ­nas: #{@protein} -- Sal: #{@sal}.  "
end
val_energetico() click to toggle source
# File lib/alu0100987522/etiqueta.rb, line 20
def val_energetico
  (grasas*9+carbh*4+protein*4)
end