Class: Dieta::Menu_DSL
- Inherits:
-
Menu
- Object
- Menu
- Dieta::Menu_DSL
show all
- Defined in:
- lib/dieta/dieta_m.rb
Instance Attribute Summary
Attributes inherited from Menu
#VCT, #grasas, #hidratos, #kilocalorias, #platos, #porcentaje, #proteinas
Instance Method Summary
collapse
Methods inherited from Menu
#<=>, #get_descripcion, #get_ingesta, #get_plato, #get_porcion, #get_pt, #to_s
Constructor Details
#initialize(tag, &block) ⇒ Menu_DSL
Returns a new instance of Menu_DSL.
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/dieta/dieta_m.rb', line 129
def initialize(tag, &block)
super([], [], [])
if block_given?
if block.arity == 1
yield self
else
instance_eval(&block)
end
end
end
|
Instance Method Details
#ingesta(options = {}) ⇒ Object
145
146
147
148
149
150
151
|
# File 'lib/dieta/dieta_m.rb', line 145
def ingesta(options = {})
@porcentaje = "#{options[:min]}"
if options[:max]
@porcentaje += "-#{options[:max]}"
end
@porcentaje += "%"
end
|
#plato(options = {}) ⇒ Object
153
154
155
156
157
158
159
160
|
# File 'lib/dieta/dieta_m.rb', line 153
def plato(options = {})
plato = [];
plato << options[:description]
plato << options[:porcion]
plato << options[:gramos].to_s
@platos << plato
end
|
#porcentajes(options = {}) ⇒ Object
162
163
164
165
166
167
|
# File 'lib/dieta/dieta_m.rb', line 162
def porcentajes(options = {})
@VCT = options[:vct].to_s
@proteinas = options[:proteinas].to_s
@grasas = options[:grasas].to_s
@hidratos = options[:hidratos].to_s
end
|
#titulo(name) ⇒ Object
141
142
143
|
# File 'lib/dieta/dieta_m.rb', line 141
def titulo(name)
@titulo = name
end
|