Class: IsoBibItem::DocumentRelation
- Inherits:
-
Object
- Object
- IsoBibItem::DocumentRelation
- Defined in:
- lib/iso_bib_item/document_relation_collection.rb
Overview
Documett relation
Instance Attribute Summary collapse
- #bib_locality ⇒ Array<IsoBibItem::BibItemLocality> readonly
- #bibitem ⇒ IsoBibItem::BibliographicItem readonly
- #identifier ⇒ String readonly
- #type ⇒ String readonly
- #url ⇒ String readonly
Instance Method Summary collapse
-
#initialize(type:, identifier:, url: nil, bib_locality: [], bibitem: nil) ⇒ DocumentRelation
constructor
A new instance of DocumentRelation.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(type:, identifier:, url: nil, bib_locality: [], bibitem: nil) ⇒ DocumentRelation
Returns a new instance of DocumentRelation.
77 78 79 80 81 82 83 84 |
# File 'lib/iso_bib_item/document_relation_collection.rb', line 77 def initialize(type:, identifier:, url: nil, bib_locality: [], bibitem: nil) type = "obsoletes" if type == "Now withdrawn" @type = type @identifier = identifier @url = url @bib_locality = bib_locality @bibitem = bibitem end |
Instance Attribute Details
#bib_locality ⇒ Array<IsoBibItem::BibItemLocality> (readonly)
73 74 75 |
# File 'lib/iso_bib_item/document_relation_collection.rb', line 73 def bib_locality @bib_locality end |
#bibitem ⇒ IsoBibItem::BibliographicItem (readonly)
70 71 72 |
# File 'lib/iso_bib_item/document_relation_collection.rb', line 70 def bibitem @bibitem end |
#identifier ⇒ String (readonly)
67 68 69 |
# File 'lib/iso_bib_item/document_relation_collection.rb', line 67 def identifier @identifier end |
#type ⇒ String (readonly)
64 65 66 |
# File 'lib/iso_bib_item/document_relation_collection.rb', line 64 def type @type end |
#url ⇒ String (readonly)
67 68 69 |
# File 'lib/iso_bib_item/document_relation_collection.rb', line 67 def url @url end |
Instance Method Details
#to_xml(builder) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/iso_bib_item/document_relation_collection.rb', line 87 def to_xml(builder) builder.relation(type: type) do if @bibitem.nil? builder.bibitem do builder.formattedref identifier # builder.docidentifier identifier end bib_locality.each do |l| l.to_xml builder end else @bibitem.to_xml(builder, {}) end # builder.url url end end |