Class: Book
- Inherits:
-
Bibliography
- Object
- Bibliography
- Book
- Defined in:
- lib/biblio/fichero.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#book ⇒ Object
Returns the value of attribute book.
-
#date ⇒ Object
Returns the value of attribute date.
-
#edition ⇒ Object
Returns the value of attribute edition.
-
#editorial ⇒ Object
Returns the value of attribute editorial.
-
#isbn10 ⇒ Object
Returns the value of attribute isbn10.
-
#series ⇒ Object
Returns the value of attribute series.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #autor(text, options = {}) ⇒ Object
- #editor(text, options = {}) ⇒ Object
- #fecha(text, options = {}) ⇒ Object
-
#initialize(title, &block) ⇒ Book
constructor
A new instance of Book.
- #isbn(tipo, options = {}) ⇒ Object
- #libro(text, options = {}) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Bibliography
Constructor Details
#initialize(title, &block) ⇒ Book
Returns a new instance of Book.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/biblio/fichero.rb', line 8 def initialize (title, &block) self. = [] 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 |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def @author end |
#book ⇒ Object
Returns the value of attribute book.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def book @book end |
#date ⇒ Object
Returns the value of attribute date.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def date @date end |
#edition ⇒ Object
Returns the value of attribute edition.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def edition @edition end |
#editorial ⇒ Object
Returns the value of attribute editorial.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def editorial @editorial end |
#isbn10 ⇒ Object
Returns the value of attribute isbn10.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def isbn10 @isbn10 end |
#series ⇒ Object
Returns the value of attribute series.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def series @series end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/biblio/fichero.rb', line 4 def title @title end |
Instance Method Details
#autor(text, options = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/biblio/fichero.rb', line 30 def autor(text, = {}) autor= text autor << "#{[:surname]}" if [:surname] autor << " #{[:name]}" if [:name] << autor end |
#editor(text, options = {}) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/biblio/fichero.rb', line 54 def editor(text, = {}) editor = text editor << " (#{[:amount]})" if [:amount] editorial << editor end |
#fecha(text, options = {}) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/biblio/fichero.rb', line 38 def fecha(text, = {}) fecha = text editor << " (#{[:amount]})" if [:amount] date << fecha end |
#isbn(tipo, options = {}) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/biblio/fichero.rb', line 61 def isbn(tipo, = {}) isbn = tipo isbn << " (#{[:number]})" if [:number] isbn10 << isbn end |
#libro(text, options = {}) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/biblio/fichero.rb', line 45 def libro(text, = {}) libro = text libro << "#{[:titulo]}" if [:titulo] libro << " (#{[:edicion]})" if [:edicion] libro << " (#{[:serie]})" if [:serie] book << libro end |
#to_s ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/biblio/fichero.rb', line 69 def to_s formato = "\nLibro en Formato APA:\n" output = formato .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 |