Class: RelatonBib::BibliographicItem::Version
- Inherits:
-
Object
- Object
- RelatonBib::BibliographicItem::Version
show all
- Includes:
- RelatonBib
- Defined in:
- lib/relaton_bib/biblio_version.rb
Constant Summary
Constants included
from RelatonBib
VERSION
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from RelatonBib
array, formattedref, hash_to_bib, localizedstring, localname, parse_date, symbolize, timestamp_hash
Constructor Details
#initialize(revision_date = nil, draft = []) ⇒ Version
Returns a new instance of Version.
15
16
17
18
|
# File 'lib/relaton_bib/biblio_version.rb', line 15
def initialize(revision_date = nil, draft = [])
@revision_date = revision_date
@draft = draft
end
|
Instance Attribute Details
#draft ⇒ Array<String>
11
12
13
|
# File 'lib/relaton_bib/biblio_version.rb', line 11
def draft
@draft
end
|
#revision_date ⇒ String, NilClass
8
9
10
|
# File 'lib/relaton_bib/biblio_version.rb', line 8
def revision_date
@revision_date
end
|
Instance Method Details
#to_hash ⇒ Hash
29
30
31
32
33
34
|
# File 'lib/relaton_bib/biblio_version.rb', line 29
def to_hash
hash = {}
hash["revision_date"] = revision_date if revision_date
hash["draft"] = single_element_array(draft) if draft&.any?
hash
end
|
#to_xml(builder) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/relaton_bib/biblio_version.rb', line 21
def to_xml(builder)
builder.version do
builder.revision_date revision_date if revision_date
draft.each { |d| builder.draft d }
end
end
|