class Book
Attributes
book[RW]
date[RW]
edition[RW]
editorial[RW]
isbn10[RW]
series[RW]
title[RW]
Public Class Methods
new(title) { |self| ... }
click to toggle source
# File lib/biblio/fichero.rb, line 8 def initialize (title, &block) self.author = [] self.title = title self.date = [] self.editorial = [] self.isbn10 = [] self.edition = [] self.series = [] self.book = [] if block_given? if block.arity == 1 yield self else instance_eval &block end end end
Public Instance Methods
autor(text, options = {})
click to toggle source
# File lib/biblio/fichero.rb, line 30 def autor(text, options = {}) autor= text autor << "#{options[:surname]}" if options[:surname] autor << " #{options[:name]}" if options[:name] author << autor end
editor(text, options = {})
click to toggle source
# File lib/biblio/fichero.rb, line 54 def editor(text, options = {}) editor = text editor << " (#{options[:amount]})" if options[:amount] editorial << editor end
fecha(text, options = {})
click to toggle source
# File lib/biblio/fichero.rb, line 38 def fecha(text, options = {}) fecha = text editor << " (#{options[:amount]})" if options[:amount] date << fecha end
isbn(tipo, options = {})
click to toggle source
# File lib/biblio/fichero.rb, line 61 def isbn(tipo, options = {}) isbn = tipo isbn << " (#{options[:number]})" if options[:number] isbn10 << isbn end
libro(text, options = {})
click to toggle source
# File lib/biblio/fichero.rb, line 45 def libro(text, options = {}) libro = text libro << "#{options[:titulo]}" if options[:titulo] libro << " (#{options[:edicion]})" if options[:edicion] libro << " (#{options[:serie]})" if options[:serie] book << libro end
to_s()
click to toggle source
# File lib/biblio/fichero.rb, line 69 def to_s formato = "\nLibro en Formato APA:\n" output = formato author.each_with_index do |instruction, index| output << "\t#{instruction}" end date.each_with_index do | date, index | output << "\n\t#{(date)}" end book.each_with_index do | book, index | output << "\n\t#{book}" end editorial.each_with_index do | editorial, index | output << "\n\tLugar de publicacion: #{(editorial)}\n" end output end