class Libro

Attributes

autor[R]
editorial[R]
fecha[R]
isbn[R]
numedicion[R]
serie[R]

Public Class Methods

new(titulo) { |self| ... } click to toggle source
# File lib/Bib/Bib.rb, line 31
def initialize(titulo, &block)
    @autor = []
    @titulo = titulo
    @serie = []
    @editorial = []
    @numedicion = []
    @fecha = []
    @isbn = []
    
    if block_given?
        if block.arity == 1
            yield self
        else
            instance_eval &block
        end
    end
    
end

Public Instance Methods

author(text, options = {}) click to toggle source
# File lib/Bib/Bib.rb, line 50
def author(text, options = {})
    author = text
    author << "(#{options[:name]})" if options[:name]
    autor << author
end
date(text, options = {}) click to toggle source
# File lib/Bib/Bib.rb, line 62
def date(text, options = {})
   date = text
   date << "(#{options[:dates]})" if options[:dates]
   fecha << date
end
edit(text, options = {}) click to toggle source
# File lib/Bib/Bib.rb, line 56
def edit(text, options = {})
    edit = text
    edit << "(#{options[:numedition]})" if options[:numedition]
    editorial << edit
end
to_s() click to toggle source
# File lib/Bib/Bib.rb, line 68
def to_s()
    output = titulo
    output << ", #{autor.join(', ')}, #{editorial.join(', ')}, #{fecha.join(', ')}\n\n"
end