class BiblioGem::Bibliography
Attributes
autor[RW]
fecha[RW]
isbn[RW]
paginas[RW]
titulo[RW]
Public Class Methods
new(args)
click to toggle source
# File lib/biblio_gem/bibliography.rb, line 7 def initialize (args) @paginas, @autor, @titulo, @fecha, @isbn =nil @autor = args[:autor] @titulo = args[:titulo] @fecha = args[:fecha] @isbn = args[:isbn] @paginas = args[:paginas] end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/biblio_gem/bibliography.rb, line 34 def <=> (other) return (self.paginas <=> other.paginas) end
to_s()
click to toggle source
# File lib/biblio_gem/bibliography.rb, line 16 def to_s libro = "" if @autor.is_a? Array libro+="Autor/es: #{@autor.join(", ")}\n" else libro+="Autor/es: #{@autor}\n" end libro+=" Titulo: #{@titulo}\n Fecha: #{@fecha}\n" if @isbn.is_a? Array libro+=" ISBN: #{@isbn.join(", ")}\n" else libro+=" ISBN: #{@isbn}\n" end libro end