Class: Menu2
- Inherits:
-
Object
- Object
- Menu2
- Defined in:
- lib/plate.rb
Instance Attribute Summary collapse
-
#componente(options = {}) ⇒ Object
Returns the value of attribute componente.
-
#descripcion(description, options = {}) ⇒ Object
Returns the value of attribute descripcion.
-
#nombre ⇒ Object
Returns the value of attribute nombre.
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Menu2
constructor
A new instance of Menu2.
- #to_s ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Menu2
Returns a new instance of Menu2.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/plate.rb', line 40 def initialize(name, &block) @nombre = name @descripcion = '' @componente = [] if block_given? if block.arity == 1 yield self else instance_eval(&block) end end end |
Instance Attribute Details
#componente(options = {}) ⇒ Object
Returns the value of attribute componente.
38 39 40 |
# File 'lib/plate.rb', line 38 def componente @componente end |
#descripcion(description, options = {}) ⇒ Object
Returns the value of attribute descripcion.
38 39 40 |
# File 'lib/plate.rb', line 38 def descripcion @descripcion end |
#nombre ⇒ Object
Returns the value of attribute nombre.
38 39 40 |
# File 'lib/plate.rb', line 38 def nombre @nombre end |
Instance Method Details
#to_s ⇒ Object
54 55 56 57 58 |
# File 'lib/plate.rb', line 54 def to_s output = @nombre output << "\n#{'=' * @nombre.size}\n\n" output << "Componentes: #{@componente.join(', ')}" end |