Class: Menu
Direct Known Subclasses
Instance Attribute Summary collapse
-
#grasas ⇒ Object
readonly
vct: valance calorico total.
-
#hidratos ⇒ Object
readonly
vct: valance calorico total.
-
#platos ⇒ Object
readonly
vct: valance calorico total.
-
#porcentaje_diario ⇒ Object
readonly
vct: valance calorico total.
-
#proteinas ⇒ Object
readonly
vct: valance calorico total.
-
#titulo ⇒ Object
readonly
vct: valance calorico total.
-
#vct ⇒ Object
readonly
vct: valance calorico total.
Instance Method Summary collapse
- #<<(plato) ⇒ Object
- #<=>(other) ⇒ Object
- #[](index) ⇒ Object
-
#initialize(info) ⇒ Menu
constructor
A new instance of Menu.
- #to_s ⇒ Object
Constructor Details
#initialize(info) ⇒ Menu
Returns a new instance of Menu.
7 8 9 10 11 12 13 14 15 |
# File 'lib/dietaryMenu/menu.rb', line 7 def initialize(info) @titulo = info[:titulo] @procentaje_diario = info[:procentaje_diario] @platos = info[:platos] @vct = info[:vct] @proteinas = info[:proteinas] @grasas = info[:grasas] @hidratos = info[:hidratos] end |
Instance Attribute Details
#grasas ⇒ Object (readonly)
vct: valance calorico total
6 7 8 |
# File 'lib/dietaryMenu/menu.rb', line 6 def grasas @grasas end |
#hidratos ⇒ Object (readonly)
vct: valance calorico total
6 7 8 |
# File 'lib/dietaryMenu/menu.rb', line 6 def hidratos @hidratos end |
#platos ⇒ Object (readonly)
vct: valance calorico total
6 7 8 |
# File 'lib/dietaryMenu/menu.rb', line 6 def platos @platos end |
#porcentaje_diario ⇒ Object (readonly)
vct: valance calorico total
6 7 8 |
# File 'lib/dietaryMenu/menu.rb', line 6 def porcentaje_diario @porcentaje_diario end |
#proteinas ⇒ Object (readonly)
vct: valance calorico total
6 7 8 |
# File 'lib/dietaryMenu/menu.rb', line 6 def proteinas @proteinas end |
#titulo ⇒ Object (readonly)
vct: valance calorico total
6 7 8 |
# File 'lib/dietaryMenu/menu.rb', line 6 def titulo @titulo end |
#vct ⇒ Object (readonly)
vct: valance calorico total
6 7 8 |
# File 'lib/dietaryMenu/menu.rb', line 6 def vct @vct end |
Instance Method Details
#<<(plato) ⇒ Object
20 21 22 23 |
# File 'lib/dietaryMenu/menu.rb', line 20 def <<(plato) @platos.push(plato) plato end |
#<=>(other) ⇒ Object
31 32 33 34 |
# File 'lib/dietaryMenu/menu.rb', line 31 def <=>(other) return nil if (other.class != Menu) @vct <=> other.vct end |
#[](index) ⇒ Object
17 18 19 |
# File 'lib/dietaryMenu/menu.rb', line 17 def [](index) @platos[index] end |
#to_s ⇒ Object
24 25 26 27 28 29 |
# File 'lib/dietaryMenu/menu.rb', line 24 def to_s description = "#{@titulo.upcase} (#{@porcentaje_diario}%)\n" description << @platos.map { |plato| "- #{plato}" }.join("\n") description << "\nV.C.T. | % #{vct} kcal | #{proteinas}% - #{grasas}% - #{hidratos}%" description end |