Class: MenuDSL
- Inherits:
-
Object
- Object
- MenuDSL
- Defined in:
- lib/prct7/menuDSL.rb
Instance Attribute Summary collapse
-
#etiqueta_ ⇒ Object
Returns the value of attribute etiqueta_.
-
#ingesta_ ⇒ Object
Returns the value of attribute ingesta_.
-
#platos_ ⇒ Object
Returns the value of attribute platos_.
-
#porcentajes_ ⇒ Object
Returns the value of attribute porcentajes_.
-
#titulo_ ⇒ Object
Returns the value of attribute titulo_.
Instance Method Summary collapse
- #ingesta(options = {}) ⇒ Object
-
#initialize(etiqueta, &block) ⇒ MenuDSL
constructor
A new instance of MenuDSL.
- #plato(options = {}) ⇒ Object
- #porcentaje(options = {}) ⇒ Object
- #titulo(options = {}) ⇒ Object
Constructor Details
#initialize(etiqueta, &block) ⇒ MenuDSL
Returns a new instance of MenuDSL.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/prct7/menuDSL.rb', line 4 def initialize(etiqueta, &block) @etiqueta_ = etiqueta @titulo_ = "" @ingesta_ = [] @platos_ = [] @porcentajes_ = [] if block_given? if block.arity == 1 yield self else instance_eval(&block) end end end |
Instance Attribute Details
#etiqueta_ ⇒ Object
Returns the value of attribute etiqueta_.
2 3 4 |
# File 'lib/prct7/menuDSL.rb', line 2 def etiqueta_ @etiqueta_ end |
#ingesta_ ⇒ Object
Returns the value of attribute ingesta_.
2 3 4 |
# File 'lib/prct7/menuDSL.rb', line 2 def ingesta_ @ingesta_ end |
#platos_ ⇒ Object
Returns the value of attribute platos_.
2 3 4 |
# File 'lib/prct7/menuDSL.rb', line 2 def platos_ @platos_ end |
#porcentajes_ ⇒ Object
Returns the value of attribute porcentajes_.
2 3 4 |
# File 'lib/prct7/menuDSL.rb', line 2 def porcentajes_ @porcentajes_ end |
#titulo_ ⇒ Object
Returns the value of attribute titulo_.
2 3 4 |
# File 'lib/prct7/menuDSL.rb', line 2 def titulo_ @titulo_ end |
Instance Method Details
#ingesta(options = {}) ⇒ Object
23 24 25 26 |
# File 'lib/prct7/menuDSL.rb', line 23 def ingesta( = {}) ingesta_ << [:min] if [:min] ingesta_ << [:max] if [:max] end |
#plato(options = {}) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/prct7/menuDSL.rb', line 28 def plato( = {}) pl = [] pl << "#{[:descripcion]}" if [:descripcion] pl << [:porcion] if [:porcion] pl << [:gramos] if [:gramos] platos_ << pl end |
#porcentaje(options = {}) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/prct7/menuDSL.rb', line 36 def porcentaje( = {}) porcentajes_ << [:vct] if [:vct] porcentajes_ << [:proteinas] if [:proteinas] porcentajes_ << [:grasas] if [:grasas] porcentajes_ << [:hidratos] if [:hidratos] end |
#titulo(options = {}) ⇒ Object
19 20 21 |
# File 'lib/prct7/menuDSL.rb', line 19 def titulo( = {}) titulo_ << "#{[:titulo]}" end |