Class: Grupo_alimento

Inherits:
Alimento_ show all
Defined in:
lib/alimento/alimento_.rb

Overview

Herencia de la clase Alimento

Instance Attribute Summary collapse

Attributes inherited from Alimento_

#datos, #fats, #glucids, #name, #proteins

Instance Method Summary collapse

Methods inherited from Alimento_

#<=>, #aibc, #valor_energetico

Constructor Details

#initialize(name, proteins, glucids, fats, group) ⇒ Grupo_alimento

Se asigna el nombre, las proteinas, los glucidos, las grasas y el grupo del alimento



65
66
67
68
# File 'lib/alimento/alimento_.rb', line 65

def initialize(name, proteins, glucids, fats, group)
    super(name, proteins, glucids, fats)
    @group = group
end

Instance Attribute Details

#grupoObject (readonly)

Returns the value of attribute grupo.



63
64
65
# File 'lib/alimento/alimento_.rb', line 63

def grupo
  @grupo
end

Instance Method Details

#to_sObject

Formatea la salida a texto



70
71
72
# File 'lib/alimento/alimento_.rb', line 70

def to_s
    string = super.to_s + "\t#{@group}"  
end