class RelatonOgc::OgcBibliographicItem

Constants

SUBTYPES
TYPES

Public Class Methods

from_hash(hash) click to toggle source

@param hash [Hash] @return [RelatonOgc::OgcBibliographicItem]

# File lib/relaton_ogc/ogc_bibliographic_item.rb, line 30
def self.from_hash(hash)
  item_hash = ::RelatonOgc::HashConverter.hash_to_bib(hash)
  new(**item_hash)
end
new(**args) click to toggle source
Calls superclass method
# File lib/relaton_ogc/ogc_bibliographic_item.rb, line 17
def initialize(**args)
  if args[:subdoctype] && !SUBTYPES.include?(args[:subdoctype])
    warn "[relaton-ogc] WARNING: invalid document "\
         "subtype: #{args[:subdoctype]}"
  end

  # @docsubtype = args.delete :docsubtype
  # @doctype = args.delete :doctype
  super
end

Public Instance Methods

to_xml(**opts) click to toggle source

@param opts [Hash] @option opts [Nokogiri::XML::Builder] :builder XML builder @option opts [Boolean] :bibdata @option opts [Symbol, NilClass] :date_format (:short), :full @option opts [String, Symbol] :lang language @return [String] XML

Calls superclass method
# File lib/relaton_ogc/ogc_bibliographic_item.rb, line 48
def to_xml(**opts)
  super(**opts) do |b|
    b.ext do
      b.doctype doctype if doctype
      b.subdoctype subdoctype if subdoctype
      editorialgroup&.to_xml b
      ics.each { |i| i.to_xml b }
    end
  end
end