Class: 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
-
#<=>(value) ⇒ Object
— Definición del Método Mixins para las comparaciones del módulo Comparable.
- #get_descripcion ⇒ Object
- #get_grasas_porcentaje ⇒ Object
- #get_hidratos_porcentaje ⇒ Object
- #get_plato(i) ⇒ Object
- #get_platos ⇒ Object
- #get_proteinas_porcetanje ⇒ Object
- #get_titulo ⇒ Object
- #get_titulo_porcentaje ⇒ Object
- #get_vct ⇒ Object
-
#initialize(titulo, titulo_porcentaje, platos, porcion, gramos, vct, proteinas_porcetanje, grasas_porcetanje, hidratos_porcentaje) ⇒ Menu
constructor
A new instance of Menu.
- #to_s ⇒ Object
Constructor Details
#initialize(titulo, titulo_porcentaje, platos, porcion, gramos, vct, proteinas_porcetanje, grasas_porcetanje, hidratos_porcentaje) ⇒ Menu
Returns a new instance of Menu.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/menus/menu.rb', line 5 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.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def gramos @gramos end |
#grasas_porcetanje ⇒ Object
Returns the value of attribute grasas_porcetanje.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def grasas_porcetanje @grasas_porcetanje end |
#hidratos_porcentaje ⇒ Object
Returns the value of attribute hidratos_porcentaje.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def hidratos_porcentaje @hidratos_porcentaje end |
#platos ⇒ Object
Returns the value of attribute platos.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def platos @platos end |
#porcion ⇒ Object
Returns the value of attribute porcion.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def porcion @porcion end |
#proteinas_porcetanje ⇒ Object
Returns the value of attribute proteinas_porcetanje.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def proteinas_porcetanje @proteinas_porcetanje end |
#titulo ⇒ Object
Returns the value of attribute titulo.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def titulo @titulo end |
#titulo_porcentaje ⇒ Object
Returns the value of attribute titulo_porcentaje.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def titulo_porcentaje @titulo_porcentaje end |
#vct ⇒ Object
Returns the value of attribute vct.
3 4 5 |
# File 'lib/menus/menu.rb', line 3 def vct @vct end |
Instance Method Details
#<=>(value) ⇒ Object
— Definición del Método Mixins para las comparaciones del módulo Comparable
19 20 21 22 |
# File 'lib/menus/menu.rb', line 19 def <=>(value) return nil unless value.instance_of? Menu @proteinas_porcetanje <=> value.proteinas_porcetanje end |
#get_descripcion ⇒ Object
24 25 26 |
# File 'lib/menus/menu.rb', line 24 def get_descripcion @descripcion end |
#get_grasas_porcentaje ⇒ Object
52 53 54 |
# File 'lib/menus/menu.rb', line 52 def get_grasas_porcentaje() @grasas_porcetanje end |
#get_hidratos_porcentaje ⇒ Object
56 57 58 |
# File 'lib/menus/menu.rb', line 56 def get_hidratos_porcentaje() @hidratos_porcentaje end |
#get_plato(i) ⇒ Object
36 37 38 |
# File 'lib/menus/menu.rb', line 36 def get_plato(i) @platos[i] end |
#get_platos ⇒ Object
40 41 42 |
# File 'lib/menus/menu.rb', line 40 def get_platos() @platos end |
#get_proteinas_porcetanje ⇒ Object
48 49 50 |
# File 'lib/menus/menu.rb', line 48 def get_proteinas_porcetanje() @proteinas_porcetanje end |
#get_titulo ⇒ Object
28 29 30 |
# File 'lib/menus/menu.rb', line 28 def get_titulo @titulo end |
#get_titulo_porcentaje ⇒ Object
32 33 34 |
# File 'lib/menus/menu.rb', line 32 def get_titulo_porcentaje @titulo_porcentaje end |
#get_vct ⇒ Object
44 45 46 |
# File 'lib/menus/menu.rb', line 44 def get_vct() @vct end |
#to_s ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/menus/menu.rb', line 60 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}%\n" return buffer end |