Class: Dieta_t
Overview
Clase dieta padre
Direct Known Subclasses
Instance Attribute Summary collapse
-
#conjplatos ⇒ Object
Returns the value of attribute conjplatos.
-
#descripcion ⇒ Object
Returns the value of attribute descripcion.
-
#ingengr ⇒ Object
Returns the value of attribute ingengr.
-
#porcdiario ⇒ Object
Returns the value of attribute porcdiario.
-
#porcgrasas ⇒ Object
Returns the value of attribute porcgrasas.
-
#porchidratos ⇒ Object
Returns the value of attribute porchidratos.
-
#porciones ⇒ Object
Returns the value of attribute porciones.
-
#porcproteinas ⇒ Object
Returns the value of attribute porcproteinas.
-
#titulo ⇒ Object
Returns the value of attribute titulo.
-
#vct ⇒ Object
Returns the value of attribute vct.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Permite comparar dietas.
-
#initialize(titulo, porcdiario, descripcion, porciones, ingengr, conjplatos, vct, porcproteinas, porcgrasas, porchidratos) ⇒ Dieta_t
constructor
Constructor de la clase Dieta_t.
-
#to_s ⇒ Object
Muestra el contenido de la clase Dieta_t.
Constructor Details
#initialize(titulo, porcdiario, descripcion, porciones, ingengr, conjplatos, vct, porcproteinas, porcgrasas, porchidratos) ⇒ Dieta_t
Constructor de la clase Dieta_t
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/prct06/dieta.rb', line 12 def initialize(titulo, porcdiario, descripcion, porciones, ingengr, conjplatos, vct, porcproteinas, porcgrasas, porchidratos) @titulo = titulo @porcdiario = porcdiario @descripcion = descripcion @porciones = porciones @ingengr = ingengr @conjplatos = conjplatos @vct = vct @porcproteinas = porcproteinas @porcgrasas = porcgrasas @porchidratos = porchidratos end |
Instance Attribute Details
#conjplatos ⇒ Object
Returns the value of attribute conjplatos.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def conjplatos @conjplatos end |
#descripcion ⇒ Object
Returns the value of attribute descripcion.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def descripcion @descripcion end |
#ingengr ⇒ Object
Returns the value of attribute ingengr.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def ingengr @ingengr end |
#porcdiario ⇒ Object
Returns the value of attribute porcdiario.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def porcdiario @porcdiario end |
#porcgrasas ⇒ Object
Returns the value of attribute porcgrasas.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def porcgrasas @porcgrasas end |
#porchidratos ⇒ Object
Returns the value of attribute porchidratos.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def porchidratos @porchidratos end |
#porciones ⇒ Object
Returns the value of attribute porciones.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def porciones @porciones end |
#porcproteinas ⇒ Object
Returns the value of attribute porcproteinas.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def porcproteinas @porcproteinas end |
#titulo ⇒ Object
Returns the value of attribute titulo.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def titulo @titulo end |
#vct ⇒ Object
Returns the value of attribute vct.
8 9 10 |
# File 'lib/prct06/dieta.rb', line 8 def vct @vct end |
Instance Method Details
#<=>(other) ⇒ Object
Permite comparar dietas
36 37 38 |
# File 'lib/prct06/dieta.rb', line 36 def <=> (other) self.vct <=> other.vct end |
#to_s ⇒ Object
Muestra el contenido de la clase Dieta_t
26 27 28 29 30 31 32 33 |
# File 'lib/prct06/dieta.rb', line 26 def to_s mostrar = "" mostrar << "\n\n#{@titulo} (#{@porcdiario} %)\n" for i in 0..(@conjplatos-1) mostrar << "- #{@descripcion[i]}, #{@porciones[i]}, #{@ingengr[i]}\n" end mostrar << "V.C.T | % #{@vct} kcal | #{@porcproteinas}% - #{@porcgrasas}% - #{@porchidratos}%\n\n" end |