Class: CiteProc::Bibliography
- Inherits:
-
Object
- Object
- CiteProc::Bibliography
- Defined in:
- lib/citeproc/bibliography.rb
Overview
A bibliography is an array of bibliographic entries and, optionally, a list of errors. The bibliography should be format agnostic; it is simply encapsulates two lists.
Instance Method Summary collapse
- #data ⇒ Object
- #errors ⇒ Object
-
#initialize(*args) {|_self| ... } ⇒ Bibliography
constructor
A new instance of Bibliography.
- #options ⇒ Object
- #to_json ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) {|_self| ... } ⇒ Bibliography
Returns a new instance of Bibliography.
8 9 10 11 12 |
# File 'lib/citeproc/bibliography.rb', line 8 def initialize(*args) args.each { |argument| parse_argument(argument) } yield self if block_given? end |
Instance Method Details
#data ⇒ Object
14 |
# File 'lib/citeproc/bibliography.rb', line 14 def data; @data ||= []; end |
#errors ⇒ Object
15 |
# File 'lib/citeproc/bibliography.rb', line 15 def errors; @errors ||= []; end |
#options ⇒ Object
16 |
# File 'lib/citeproc/bibliography.rb', line 16 def ; @options ||= {}; end |
#to_json ⇒ Object
25 26 27 |
# File 'lib/citeproc/bibliography.rb', line 25 def to_json [.merge('bibliography-errors' => errors), data].to_json end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/citeproc/bibliography.rb', line 29 def to_s [['bibstart'] || '<div class="csl-bib-body">', data.map { |d| " <div class=\"csl-entry\">#{d}</div>" }, ['bibend'] || '</div>'].flatten.join("\n") end |