Class: RelatonBib::BiblioNote
Constant Summary
FormattedString::FORMATS
Constants included
from RelatonBib
VERSION
Instance Attribute Summary collapse
#format
#content, #language, #script
Instance Method Summary
collapse
#empty?, #to_s
Methods included from RelatonBib
parse_date
Constructor Details
#initialize(content:, type: nil, language: nil, script: nil, format: nil) ⇒ BiblioNote
Returns a new instance of BiblioNote.
11
12
13
14
|
# File 'lib/relaton_bib/biblio_note.rb', line 11
def initialize(content:, type: nil, language: nil, script: nil, format: nil)
@type = type
super content: content, language: language, script: script, format: format
end
|
Instance Attribute Details
#type ⇒ String, NilClass
4
5
6
|
# File 'lib/relaton_bib/biblio_note.rb', line 4
def type
@type
end
|
Instance Method Details
#to_asciibib(prefix = "", count = 1) ⇒ String
36
37
38
39
40
41
42
|
# File 'lib/relaton_bib/biblio_note.rb', line 36
def to_asciibib(prefix = "", count = 1)
pref = prefix.empty? ? prefix : prefix + "."
out = count > 1 ? "#{pref}biblionote::\n" : ""
out + "#{pref}biblionote.type:: #{type}\n" if type
out += super "#{pref}biblionote"
out
end
|
#to_hash ⇒ Hash
24
25
26
27
28
29
30
31
|
# File 'lib/relaton_bib/biblio_note.rb', line 24
def to_hash
hash = super
return hash unless type
hash = { "content" => hash } if hash.is_a? String
hash["type"] = type
hash
end
|
#to_xml(builder) ⇒ Object
17
18
19
20
21
|
# File 'lib/relaton_bib/biblio_note.rb', line 17
def to_xml(builder)
xml = builder.note { super }
xml[:type] = type if type
xml
end
|