Class: Menu
Direct Known Subclasses
Instance Attribute Summary collapse
-
#grasas ⇒ Object
readonly
Returns the value of attribute grasas.
-
#hidratos ⇒ Object
readonly
Returns the value of attribute hidratos.
-
#platos ⇒ Object
readonly
Returns the value of attribute platos.
-
#porcentaje ⇒ Object
readonly
Returns the value of attribute porcentaje.
-
#proteinas ⇒ Object
readonly
Returns the value of attribute proteinas.
-
#titulo ⇒ Object
readonly
Returns the value of attribute titulo.
-
#vct ⇒ Object
readonly
Returns the value of attribute vct.
Instance Method Summary collapse
- #<=>(otro) ⇒ Object
- #get_grasas ⇒ Object
- #get_hidratos ⇒ Object
- #get_plato(i) ⇒ Object
- #get_porcentaje ⇒ Object
- #get_proteinas ⇒ Object
- #get_titulo ⇒ Object
- #get_vct ⇒ Object
- #getall_platos ⇒ Object
-
#initialize(titulo, porcentaje, platos, vct, proteinas, grasas, hidratos) ⇒ Menu
constructor
A new instance of Menu.
- #to_s ⇒ Object
Constructor Details
#initialize(titulo, porcentaje, platos, vct, proteinas, grasas, hidratos) ⇒ Menu
Returns a new instance of Menu.
6 7 8 |
# File 'lib/dieta/menu.rb', line 6 def initialize titulo, porcentaje, platos, vct, proteinas, grasas, hidratos @titulo, @porcentaje, @platos, @vct, @proteinas, @grasas, @hidratos = titulo, porcentaje, platos, vct, proteinas, grasas, hidratos end |
Instance Attribute Details
#grasas ⇒ Object (readonly)
Returns the value of attribute grasas.
5 6 7 |
# File 'lib/dieta/menu.rb', line 5 def grasas @grasas end |
#hidratos ⇒ Object (readonly)
Returns the value of attribute hidratos.
5 6 7 |
# File 'lib/dieta/menu.rb', line 5 def hidratos @hidratos end |
#platos ⇒ Object (readonly)
Returns the value of attribute platos.
5 6 7 |
# File 'lib/dieta/menu.rb', line 5 def platos @platos end |
#porcentaje ⇒ Object (readonly)
Returns the value of attribute porcentaje.
5 6 7 |
# File 'lib/dieta/menu.rb', line 5 def porcentaje @porcentaje end |
#proteinas ⇒ Object (readonly)
Returns the value of attribute proteinas.
5 6 7 |
# File 'lib/dieta/menu.rb', line 5 def proteinas @proteinas end |
#titulo ⇒ Object (readonly)
Returns the value of attribute titulo.
5 6 7 |
# File 'lib/dieta/menu.rb', line 5 def titulo @titulo end |
#vct ⇒ Object (readonly)
Returns the value of attribute vct.
5 6 7 |
# File 'lib/dieta/menu.rb', line 5 def vct @vct end |
Instance Method Details
#<=>(otro) ⇒ Object
39 40 41 |
# File 'lib/dieta/menu.rb', line 39 def <=>(otro) titulo<=>otro.titulo end |
#get_grasas ⇒ Object
33 34 35 |
# File 'lib/dieta/menu.rb', line 33 def get_grasas @grasas end |
#get_hidratos ⇒ Object
36 37 38 |
# File 'lib/dieta/menu.rb', line 36 def get_hidratos @hidratos end |
#get_plato(i) ⇒ Object
12 13 14 |
# File 'lib/dieta/menu.rb', line 12 def get_plato i @platos[i] end |
#get_porcentaje ⇒ Object
21 22 23 |
# File 'lib/dieta/menu.rb', line 21 def get_porcentaje @porcentaje end |
#get_proteinas ⇒ Object
30 31 32 |
# File 'lib/dieta/menu.rb', line 30 def get_proteinas @proteinas end |
#get_titulo ⇒ Object
9 10 11 |
# File 'lib/dieta/menu.rb', line 9 def get_titulo @titulo end |
#get_vct ⇒ Object
18 19 20 |
# File 'lib/dieta/menu.rb', line 18 def get_vct @vct end |
#getall_platos ⇒ Object
15 16 17 |
# File 'lib/dieta/menu.rb', line 15 def getall_platos @platos end |
#to_s ⇒ Object
24 25 26 27 28 29 |
# File 'lib/dieta/menu.rb', line 24 def to_s out = "#{@titulo.upcase} (#{@porcentaje}%)\n" out << @platos.map { |plato| "- #{plato}" }.join(",\n") out << "\nV.C.T. | % #{vct} kcal | #{proteinas}% - #{grasas}% - #{hidratos}%" out end |