Class: Menu2

Inherits:
Object
  • Object
show all
Defined in:
lib/plate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nombreObject

Returns the value of attribute nombre.



38
39
40
# File 'lib/plate.rb', line 38

def nombre
  @nombre
end

Instance Method Details

#to_sObject



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