class Libro

Attributes

edicion[RW]
lugar[RW]
volumen[RW]

Public Class Methods

new(titulo) { |self| ... } click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 56
def initialize(titulo,&block)
    
     self.titulo = titulo
     self.autor = []
     self.fecha = []
     self.edicion = []
     self.volumen = []
     self.lugar = []
     
     if block_given?  
          if block.arity == 1
               yield self
          else
               instance_eval &block 
          end
     end
end

Public Instance Methods

author(name, options = {}) click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 79
def author(name, options = {})
     author = name
     author << " (#{options[:amount]})" if options[:amount]
     autor << author
end
date(name, options = {}) click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 74
def date(name, options = {})
     date = name
     fecha << date
end
edition(name, options = {}) click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 85
def edition(name, options = {})
     edition = name
     edicion << edition
end
site(name, options = {}) click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 93
def site(name, options = {})
     site = name
     lugar << site
end
to_s() click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 98
def to_s()
     
     output = titulo
     output << " #{autor.join(', ')} "
     output << "(#{fecha.join(', ')}) "
     output << "(#{edicion.join(', ')}) "
     output << "(#{volumen.join(', ')}) "
     output << "#{lugar.join(', ')} "

     output
end
volume(name, options = {}) click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 89
def volume(name, options = {})
     volume = name
     volumen << volume
end