Class: RelatonBib::BibliographicItem::Version
- Includes:
- RelatonBib
- Defined in:
- lib/relaton_bib/biblio_version.rb
Constant Summary
Constants included from RelatonBib
Instance Attribute Summary collapse
- #draft ⇒ String? readonly
- #revision_date ⇒ String? readonly
Instance Method Summary collapse
-
#initialize(revision_date = nil, draft = nil) ⇒ Version
constructor
A new instance of Version.
- #to_asciibib(prefix = "", count = 1) ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Methods included from RelatonBib
Constructor Details
#initialize(revision_date = nil, draft = nil) ⇒ Version
Returns a new instance of Version.
12 13 14 15 |
# File 'lib/relaton_bib/biblio_version.rb', line 12 def initialize(revision_date = nil, draft = nil) @revision_date = revision_date @draft = draft end |
Instance Attribute Details
#draft ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_bib/biblio_version.rb', line 8 def draft @draft end |
#revision_date ⇒ String? (readonly)
8 9 10 |
# File 'lib/relaton_bib/biblio_version.rb', line 8 def revision_date @revision_date end |
Instance Method Details
#to_asciibib(prefix = "", count = 1) ⇒ String
35 36 37 38 39 40 41 42 43 |
# File 'lib/relaton_bib/biblio_version.rb', line 35 def to_asciibib(prefix = "", count = 1) pref = prefix.empty? ? prefix : "#{prefix}." out = count > 1 ? "#{prefix}version::\n" : "" if revision_date out += "#{pref}version.revision_date:: #{revision_date}\n" end out += "#{pref}version.draft:: #{draft}\n" if draft out end |
#to_hash ⇒ Hash
26 27 28 29 30 31 |
# File 'lib/relaton_bib/biblio_version.rb', line 26 def to_hash hash = {} hash["revision_date"] = revision_date if revision_date hash["draft"] = draft if draft hash end |
#to_xml(builder) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/relaton_bib/biblio_version.rb', line 18 def to_xml(builder) builder.version do builder.send(:"revision-date", revision_date) if revision_date builder.draft draft if draft end end |