class Biblio

Attributes

autor[RW]
fecha[RW]
titulo[RW]

Public Class Methods

new(titulo) { |self| ... } click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 6
def initialize(titulo, &block)

     self.titulo = titulo
     self.autor = []
     self.fecha = []

     if block_given?  
          if block.arity == 1
               yield self
          else
               instance_eval &block 
          end
     end
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 33
def <=>(other)
     
     if(@autor != other.autor)
          @autor <=> other.autor
     elsif(@autor == other.autor)
          @fecha <=> other.fecha
     elsif(@fecha == other.fecha && @autor == other.autor)
          @titulo <=> other.titulo
     end
end
author(name, options = {}) click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 27
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 21
def date(name, options = {})
     date = name
     
     fecha << date
end
to_s() click to toggle source
# File lib/biblioalu0100815146/biblio.rb, line 45
def to_s()
   @salida = " AUTOR/ES: " + "#{@autor}" + " TITULO: " + "#{@titulo}" + " FECHA: " + "#{@fecha}" 
end