class IsoBibItem::DocumentRelation

Documett relation

Attributes

bib_locality[R]

@return [Array<IsoBibItem::BibItemLocality>]

bibitem[R]

@return [IsoBibItem::BibliographicItem]

identifier[R]

@return [String]

type[R]

@return [String]

url[R]

@return [String]

Public Class Methods

new(type:, identifier:, url: nil, bib_locality: [], bibitem: nil) click to toggle source

@param type [String] @param identifier [String]

# 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

Public Instance Methods

to_xml(builder) click to toggle source

@param builder [Nokogiri::XML::Builder]

# 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