Class: AlimentoC
Overview
require “valor_calorico.rb”
Instance Attribute Summary collapse
-
#grupo ⇒ Object
Returns the value of attribute grupo.
Attributes inherited from Alimento
#datos, #glucidos, #lipidos, #nombre, #proteinas
Instance Method Summary collapse
-
#initialize(nombre, proteinas, glucidos, lipidos, grupo) ⇒ Object
constructor
AlimentoC type of the class.
-
#to_s ⇒ String
The resulting of join all the information, name, protein, glucids, lipids and group.
Methods inherited from Alimento
#<=>, #==, #AIBC, #valor_calorico
Constructor Details
#initialize(nombre, proteinas, glucidos, lipidos, grupo) ⇒ Object
Returns AlimentoC type of the class.
13 14 15 16 |
# File 'lib/prct06/AlimentoC.rb', line 13 def initialize(nombre, proteinas, glucidos, lipidos, grupo) super(nombre, proteinas, glucidos, lipidos) @grupo = grupo end |
Instance Attribute Details
#grupo ⇒ Object
Returns the value of attribute grupo.
9 10 11 |
# File 'lib/prct06/AlimentoC.rb', line 9 def grupo @grupo end |
Instance Method Details
#to_s ⇒ String
Returns the resulting of join all the information, name, protein, glucids, lipids and group.
19 20 21 22 23 |
# File 'lib/prct06/AlimentoC.rb', line 19 def to_s s = super.to_s s += "\t#{@grupo}" s end |