Class: RelatonBib::Renderer::BibtexBuilder
- Defined in:
- lib/relaton_bib/renderer/bibtex_builder.rb
Constant Summary collapse
- ATTRS =
%i[ type id title author editor booktitle series number edition contributor date address note relation extent classification keyword docidentifier timestamp link ].freeze
Class Method Summary collapse
-
.build(bib, bibtex = nil) ⇒ BibTeX::Bibliography
Build BibTeX bibliography.
Instance Method Summary collapse
-
#build(bibtex = nil) ⇒ BibTeX::Bibliography
Build BibTeX bibliography.
-
#initialize(bib) ⇒ BibtexBuilder
constructor
Initialize BibTeX builder.
Constructor Details
#initialize(bib) ⇒ BibtexBuilder
Initialize BibTeX builder.
44 45 46 |
# File 'lib/relaton_bib/renderer/bibtex_builder.rb', line 44 def initialize(bib) @bib = bib end |
Class Method Details
.build(bib, bibtex = nil) ⇒ BibTeX::Bibliography
Build BibTeX bibliography.
36 37 38 |
# File 'lib/relaton_bib/renderer/bibtex_builder.rb', line 36 def self.build(bib, bibtex = nil) new(bib).build bibtex end |
Instance Method Details
#build(bibtex = nil) ⇒ BibTeX::Bibliography
Build BibTeX bibliography.
55 56 57 58 59 60 61 |
# File 'lib/relaton_bib/renderer/bibtex_builder.rb', line 55 def build(bibtex = nil) @item = BibTeX::Entry.new ATTRS.each { |a| send("add_#{a}") } bibtex ||= BibTeX::Bibliography.new bibtex << @item bibtex end |