Class: Menu
Overview
Clase que representa un menu
Direct Known Subclasses
Instance Attribute Summary collapse
-
#gramos ⇒ Object
Returns the value of attribute gramos.
-
#grasas_porcetanje ⇒ Object
Returns the value of attribute grasas_porcetanje.
-
#hidratos_porcentaje ⇒ Object
Returns the value of attribute hidratos_porcentaje.
-
#platos ⇒ Object
Returns the value of attribute platos.
-
#porcion ⇒ Object
Returns the value of attribute porcion.
-
#proteinas_porcetanje ⇒ Object
Returns the value of attribute proteinas_porcetanje.
-
#titulo ⇒ Object
Returns the value of attribute titulo.
-
#titulo_porcentaje ⇒ Object
Returns the value of attribute titulo_porcentaje.
-
#vct ⇒ Object
Returns the value of attribute vct.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#get_descripcion ⇒ Object
Obtener descripcion.
- #get_grasas_porcentaje ⇒ Object
- #get_hidratos_porcentaje ⇒ Object
-
#get_plato(i) ⇒ Object
Obtener un plato.
-
#get_platos ⇒ Object
Obtener la lista de platos.
- #get_proteinas_porcetanje ⇒ Object
-
#get_titulo ⇒ Object
Obtener titulo.
-
#get_titulo_porcentaje ⇒ Object
Obtener porcentaje.
-
#get_vct ⇒ Object
Obtener el valor calorico total.
-
#initialize(titulo, titulo_porcentaje, platos, porcion, gramos, vct, proteinas_porcetanje, grasas_porcetanje, hidratos_porcentaje) ⇒ Menu
constructor
Constructor de la clase.
- #to_s ⇒ Object
Constructor Details
#initialize(titulo, titulo_porcentaje, platos, porcion, gramos, vct, proteinas_porcetanje, grasas_porcetanje, hidratos_porcentaje) ⇒ Menu
Constructor de la clase
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/menus/menu.rb', line 13 def initialize(titulo, titulo_porcentaje, platos, porcion, gramos, vct, proteinas_porcetanje, grasas_porcetanje, hidratos_porcentaje) @titulo = titulo @titulo_porcentaje = titulo_porcentaje @platos = platos @porcion = porcion @gramos = gramos @vct = vct @proteinas_porcetanje = proteinas_porcetanje @grasas_porcetanje = grasas_porcetanje @hidratos_porcentaje = hidratos_porcentaje end |
Instance Attribute Details
#gramos ⇒ Object
Returns the value of attribute gramos.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def gramos @gramos end |
#grasas_porcetanje ⇒ Object
Returns the value of attribute grasas_porcetanje.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def grasas_porcetanje @grasas_porcetanje end |
#hidratos_porcentaje ⇒ Object
Returns the value of attribute hidratos_porcentaje.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def hidratos_porcentaje @hidratos_porcentaje end |
#platos ⇒ Object
Returns the value of attribute platos.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def platos @platos end |
#porcion ⇒ Object
Returns the value of attribute porcion.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def porcion @porcion end |
#proteinas_porcetanje ⇒ Object
Returns the value of attribute proteinas_porcetanje.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def proteinas_porcetanje @proteinas_porcetanje end |
#titulo ⇒ Object
Returns the value of attribute titulo.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def titulo @titulo end |
#titulo_porcentaje ⇒ Object
Returns the value of attribute titulo_porcentaje.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def titulo_porcentaje @titulo_porcentaje end |
#vct ⇒ Object
Returns the value of attribute vct.
4 5 6 |
# File 'lib/menus/menu.rb', line 4 def vct @vct end |
Instance Method Details
#<=>(other) ⇒ Object
8 9 10 |
# File 'lib/menus/menu.rb', line 8 def <=>(other) @vct <=> other.vct end |
#get_descripcion ⇒ Object
Obtener descripcion
26 27 28 |
# File 'lib/menus/menu.rb', line 26 def get_descripcion @descripcion end |
#get_grasas_porcentaje ⇒ Object
60 61 62 |
# File 'lib/menus/menu.rb', line 60 def get_grasas_porcentaje() @grasas_porcetanje end |
#get_hidratos_porcentaje ⇒ Object
64 65 66 |
# File 'lib/menus/menu.rb', line 64 def get_hidratos_porcentaje() @hidratos_porcentaje end |
#get_plato(i) ⇒ Object
Obtener un plato
41 42 43 |
# File 'lib/menus/menu.rb', line 41 def get_plato(i) @platos[i] end |
#get_platos ⇒ Object
Obtener la lista de platos
47 48 49 |
# File 'lib/menus/menu.rb', line 47 def get_platos() @platos end |
#get_proteinas_porcetanje ⇒ Object
56 57 58 |
# File 'lib/menus/menu.rb', line 56 def get_proteinas_porcetanje() @proteinas_porcetanje end |
#get_titulo ⇒ Object
Obtener titulo
31 32 33 |
# File 'lib/menus/menu.rb', line 31 def get_titulo @titulo end |
#get_titulo_porcentaje ⇒ Object
Obtener porcentaje
36 37 38 |
# File 'lib/menus/menu.rb', line 36 def get_titulo_porcentaje @titulo_porcentaje end |
#get_vct ⇒ Object
Obtener el valor calorico total
52 53 54 |
# File 'lib/menus/menu.rb', line 52 def get_vct() @vct end |
#to_s ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/menus/menu.rb', line 68 def to_s buffer = "#{@titulo} #{@titulo_porcentaje}\n" i = 0; while i < @platos.size() buffer << "#{platos[i]}, #{porcion[i]}, #{gramos[i]} g\n" i = i + 1 end buffer << "V.C.T. | % #{@vct} kcal | #{@proteinas_porcetanje}% - #{@hidratos_porcentaje}% - #{@grasas_porcetanje}%" return buffer end |