class Plate

Attributes

alimento[RW]
nombre[RW]

Public Class Methods

new(name) { |self| ... } click to toggle source
# File lib/plate.rb, line 4
def initialize(name, &block)
  @nombre = name
  @alimento = []
  
  if block_given?  
    if block.arity == 1
      yield self
    else
     instance_eval(&block) 
    end
  end
end

Public Instance Methods

to_s() click to toggle source
# File lib/plate.rb, line 17
def to_s
  output = @nombre
  output << "\n#{'=' * @nombre.size}\n\n"
  output << "Alimentos: #{@alimento.join(', ')}\n\n"

  output
end