Class: Dieta
Overview
Implementar en este fichero la clase para crear objetos racionales
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cantidad_platos ⇒ Object
Returns the value of attribute cantidad_platos.
-
#comida ⇒ Object
Returns the value of attribute comida.
-
#gr_platos ⇒ Object
Returns the value of attribute gr_platos.
-
#platos_comida ⇒ Object
Returns the value of attribute platos_comida.
-
#porcentaje_comida ⇒ Object
Returns the value of attribute porcentaje_comida.
-
#porcentaje_grasas ⇒ Object
Returns the value of attribute porcentaje_grasas.
-
#porcentaje_hidratos ⇒ Object
Returns the value of attribute porcentaje_hidratos.
-
#porcentaje_proteinas ⇒ Object
Returns the value of attribute porcentaje_proteinas.
-
#vct ⇒ Object
Returns the value of attribute vct.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Trabajamos con las calorias(vct).
-
#get_cantidad_platos ⇒ Object
GET CANTIDAD PALTOS.
-
#get_comida ⇒ Object
GET COMIDA.
-
#get_gr_platos ⇒ Object
GET GRAMOS PLATOS.
-
#get_platos_comida ⇒ Object
GET PLATOS COMIDA.
-
#get_porcentaje_comida ⇒ Object
GET PORCETAJE COMIDA.
-
#get_porcentaje_grasas ⇒ Object
GET PORCENTAJE DE GRASAS.
-
#get_porcentaje_hidratos ⇒ Object
GET PORCENTAJE DE HIDRATOS.
-
#get_porcentaje_proteinas ⇒ Object
GET PORCENTAJE DE PROTEINAS.
-
#get_vct ⇒ Object
GET CALORIAS.
-
#initialize(comida, porcentaje_comida, platos_comida, cantidad_platos, gr_platos, vct, porcentaje_proteinas, porcentaje_grasas, porcentaje_hidratos) ⇒ Dieta
constructor
FUINCION INITIALIZE.
-
#ordenacion_gr ⇒ Object
FUNCION SORT.
-
#to_s ⇒ Object
TO_S.
Constructor Details
#initialize(comida, porcentaje_comida, platos_comida, cantidad_platos, gr_platos, vct, porcentaje_proteinas, porcentaje_grasas, porcentaje_hidratos) ⇒ Dieta
FUINCION INITIALIZE
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dietas/dietas.rb', line 13 def initialize(comida,porcentaje_comida,platos_comida,cantidad_platos,gr_platos,vct,porcentaje_proteinas,porcentaje_grasas,porcentaje_hidratos) @comida=comida @porcentaje_comida=porcentaje_comida @platos_comida=platos_comida @cantidad_platos=cantidad_platos @gr_platos=gr_platos @vct=vct @porcentaje_proteinas=porcentaje_proteinas @porcentaje_grasas=porcentaje_grasas @porcentaje_hidratos=porcentaje_hidratos end |
Instance Attribute Details
#cantidad_platos ⇒ Object
Returns the value of attribute cantidad_platos.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def cantidad_platos @cantidad_platos end |
#comida ⇒ Object
Returns the value of attribute comida.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def comida @comida end |
#gr_platos ⇒ Object
Returns the value of attribute gr_platos.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def gr_platos @gr_platos end |
#platos_comida ⇒ Object
Returns the value of attribute platos_comida.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def platos_comida @platos_comida end |
#porcentaje_comida ⇒ Object
Returns the value of attribute porcentaje_comida.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def porcentaje_comida @porcentaje_comida end |
#porcentaje_grasas ⇒ Object
Returns the value of attribute porcentaje_grasas.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def porcentaje_grasas @porcentaje_grasas end |
#porcentaje_hidratos ⇒ Object
Returns the value of attribute porcentaje_hidratos.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def porcentaje_hidratos @porcentaje_hidratos end |
#porcentaje_proteinas ⇒ Object
Returns the value of attribute porcentaje_proteinas.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def porcentaje_proteinas @porcentaje_proteinas end |
#vct ⇒ Object
Returns the value of attribute vct.
10 11 12 |
# File 'lib/dietas/dietas.rb', line 10 def vct @vct end |
Instance Method Details
#<=>(other) ⇒ Object
Trabajamos con las calorias(vct)
26 27 28 |
# File 'lib/dietas/dietas.rb', line 26 def <=> other vct <=> other.vct end |
#get_cantidad_platos ⇒ Object
GET CANTIDAD PALTOS
47 48 49 |
# File 'lib/dietas/dietas.rb', line 47 def get_cantidad_platos @cantidad_platos end |
#get_comida ⇒ Object
GET COMIDA
32 33 34 |
# File 'lib/dietas/dietas.rb', line 32 def get_comida @comida end |
#get_gr_platos ⇒ Object
GET GRAMOS PLATOS
52 53 54 |
# File 'lib/dietas/dietas.rb', line 52 def get_gr_platos @gr_platos end |
#get_platos_comida ⇒ Object
GET PLATOS COMIDA
42 43 44 |
# File 'lib/dietas/dietas.rb', line 42 def get_platos_comida @platos_comida end |
#get_porcentaje_comida ⇒ Object
GET PORCETAJE COMIDA
37 38 39 |
# File 'lib/dietas/dietas.rb', line 37 def get_porcentaje_comida @porcentaje_comida end |
#get_porcentaje_grasas ⇒ Object
GET PORCENTAJE DE GRASAS
67 68 69 |
# File 'lib/dietas/dietas.rb', line 67 def get_porcentaje_grasas @porcentaje_grasas end |
#get_porcentaje_hidratos ⇒ Object
GET PORCENTAJE DE HIDRATOS
72 73 74 |
# File 'lib/dietas/dietas.rb', line 72 def get_porcentaje_hidratos @porcentaje_hidratos end |
#get_porcentaje_proteinas ⇒ Object
GET PORCENTAJE DE PROTEINAS
62 63 64 |
# File 'lib/dietas/dietas.rb', line 62 def get_porcentaje_proteinas @porcentaje_proteinas end |
#get_vct ⇒ Object
GET CALORIAS
57 58 59 |
# File 'lib/dietas/dietas.rb', line 57 def get_vct @vct end |
#ordenacion_gr ⇒ Object
FUNCION SORT
77 78 79 |
# File 'lib/dietas/dietas.rb', line 77 def ordenacion_gr @gr_platos.sort end |
#to_s ⇒ Object
TO_S
82 83 84 85 86 87 88 89 |
# File 'lib/dietas/dietas.rb', line 82 def to_s s="\n#{@comida} (#{@porcentaje_comida})\n" (0..@platos_comida.size-1).each do |i| s<< "#{@platos_comida[i]}, #{@cantidad_platos[i]}, #{@gr_platos[i]}g.\n" end s<< "VCT | %\t#{@vct} kcal | #{@porcentaje_proteinas}% - #{@porcentaje_grasas}% - #{@porcentaje_hidratos}%\n" s end |