Class: RelatonBib::DocumentRelation
- Inherits:
-
Object
- Object
- RelatonBib::DocumentRelation
- Defined in:
- lib/relaton_bib/document_relation.rb
Overview
Documett relation
Instance Attribute Summary collapse
- #bib_locality ⇒ Array<RelatonBib::BibItemLocality> readonly
- #bibitem ⇒ RelatonBib::BibliographicItem readonly
- #type ⇒ String readonly
Instance Method Summary collapse
-
#initialize(type:, bibitem:, bib_locality: []) ⇒ DocumentRelation
constructor
A new instance of DocumentRelation.
- #to_xml(builder, **opts) ⇒ Object
Constructor Details
#initialize(type:, bibitem:, bib_locality: []) ⇒ DocumentRelation
Returns a new instance of DocumentRelation.
32 33 34 35 36 37 |
# File 'lib/relaton_bib/document_relation.rb', line 32 def initialize(type:, bibitem:, bib_locality: []) type = "obsoletes" if type == "Now withdrawn" @type = type @bib_locality = bib_locality @bibitem = bibitem end |
Instance Attribute Details
#bib_locality ⇒ Array<RelatonBib::BibItemLocality> (readonly)
27 28 29 |
# File 'lib/relaton_bib/document_relation.rb', line 27 def bib_locality @bib_locality end |
#bibitem ⇒ RelatonBib::BibliographicItem (readonly)
24 25 26 |
# File 'lib/relaton_bib/document_relation.rb', line 24 def bibitem @bibitem end |
#type ⇒ String (readonly)
18 19 20 |
# File 'lib/relaton_bib/document_relation.rb', line 18 def type @type end |
Instance Method Details
#to_xml(builder, **opts) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/relaton_bib/document_relation.rb', line 40 def to_xml(builder, **opts) opts.delete :bibdata opts.delete :note builder.relation(type: type) do bibitem.to_xml(builder, **opts.merge(embedded: true)) bib_locality.each do |l| l.to_xml builder end end end |