Class: References::Book

Inherits:
Reference show all
Defined in:
lib/references/book.rb

Overview

Represent a book reference

Instance Attribute Summary

Attributes inherited from Reference

#authors, #datee

Instance Method Summary collapse

Methods inherited from Reference

#<=>, #author, #cantidadAuthors, #cantidadIsbn, #cantidadSeries, #date, #editorial, #hasDate, #hasEdition, #hasEditionnumber, #hasTitle, #initialize, #prettyOutput, #title

Constructor Details

This class inherits a constructor from References::Reference

Instance Method Details

#formatAPAString

Format book reference to APA standard

Returns:

  • (String)

    format output



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/references/book.rb', line 9

def formatAPA
  (prettyOutput(@authors.map { |x| x.to_s }) + "(" + @datee.year.to_s + ") " + @title +
    if @subtitle
      ": " + @subtitle + "."
    else
      ""
    end +
   "\n\t"+@serie+". (" + @edition.to_s + ") " +
   "(" + @editionnumber.to_s + ") " +
   @isbn.join(", "))
end

#isbn(isbn) ⇒ Object

Set some isbn of document, each isbn is store in a list, you can have some in the same book params isbn [String]



29
30
31
32
33
34
# File 'lib/references/book.rb', line 29

def isbn(isbn)
  if @isbn.nil?
    @isbn = []
  end
  @isbn << isbn
end

#subtitle(subtitle) ⇒ Object

Set subtitle of document params subtitle [String]



23
24
25
# File 'lib/references/book.rb', line 23

def subtitle(subtitle)
  @subtitle = subtitle
end