Class: Book
Direct Known Subclasses
Instance Attribute Summary collapse
-
#authors ⇒ Object
Returns the value of attribute authors.
-
#edition ⇒ Object
Returns the value of attribute edition.
-
#editorial ⇒ Object
Returns the value of attribute editorial.
-
#isbn ⇒ Object
Returns the value of attribute isbn.
-
#volume ⇒ Object
Returns the value of attribute volume.
Attributes inherited from Reference
Instance Method Summary collapse
-
#initialize(title, editorial, edition, date, isbn, authors, volume) ⇒ Book
constructor
A new instance of Book.
- #to_s ⇒ Object
Methods inherited from Reference
Constructor Details
#initialize(title, editorial, edition, date, isbn, authors, volume) ⇒ Book
Returns a new instance of Book.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/prct11/book.rb', line 6 def initialize(title,editorial,edition,date,isbn,, volume) super(,title,date) = @volume = volume @editorial = editorial @edition = edition self.isbn = [] isbn.each do |numeros| @isbn.push(numeros) end return self end |
Instance Attribute Details
#authors ⇒ Object
Returns the value of attribute authors.
4 5 6 |
# File 'lib/prct11/book.rb', line 4 def end |
#edition ⇒ Object
Returns the value of attribute edition.
4 5 6 |
# File 'lib/prct11/book.rb', line 4 def edition @edition end |
#editorial ⇒ Object
Returns the value of attribute editorial.
4 5 6 |
# File 'lib/prct11/book.rb', line 4 def editorial @editorial end |
#isbn ⇒ Object
Returns the value of attribute isbn.
4 5 6 |
# File 'lib/prct11/book.rb', line 4 def isbn @isbn end |
#volume ⇒ Object
Returns the value of attribute volume.
4 5 6 |
# File 'lib/prct11/book.rb', line 4 def volume @volume end |
Instance Method Details
#to_s ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/prct11/book.rb', line 20 def to_s text="" for i in (0...size-2) text << "#{authors[i]} , " end text << "#{authors[authors.size-1]}." text << "\n#{@title}." text << "\n#{@volume}." text << "\n#{@editorial}; #{@edition} Edition (#{@date})." for i in (0..@isbn.size-1) text << "\nISBN #{@isbn[i].length}: #{@isbn[i]}." end text end |