class RelatonIho::IhoBibliographicItem

Constants

TYPES

Attributes

commentperiod[R]

@return [RelatonIho::CommentPeriod, NilClass]

Public Class Methods

from_hash(hash) click to toggle source

@param hash [Hash] @return [RelatonIho::IhoBibliographicItem]

# File lib/relaton_iho/iho_bibliographic_item.rb, line 18
def self.from_hash(hash)
  item_hash = ::RelatonIho::HashConverter.hash_to_bib(hash)
  new **item_hash
end
new(**args) click to toggle source

@param editorialgroup [RelatonIho::EditorialGroupCollection] @param commentperiod [RelatonIho::CommentPeriod, NilClass]

Calls superclass method
# File lib/relaton_iho/iho_bibliographic_item.rb, line 11
def initialize(**args)
  @commentperiod = args.delete :commentperiod
  super
end

Public Instance Methods

to_asciibib(prefix = "") click to toggle source

@param prefix [String] @return [String]

Calls superclass method
# File lib/relaton_iho/iho_bibliographic_item.rb, line 51
def to_asciibib(prefix = "")
  out = super
  out += commentperiod.to_asciibib prefix if commentperiod
  out
end
to_hash() click to toggle source

@return [Hash]

Calls superclass method
# File lib/relaton_iho/iho_bibliographic_item.rb, line 43
def to_hash
  hash = super
  hash["commentperiod"] = commentperiod.to_hash if commentperiod
  hash
end
to_xml(**opts) click to toggle source

@param opts [Hash] @option opts [Nokogiri::XML::Builder] :builder XML builder @option opts [Boolean] :bibdata @option opts [String] :lang language @return [String] XML

Calls superclass method
# File lib/relaton_iho/iho_bibliographic_item.rb, line 28
def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
  super ext: !commentperiod.nil?, **opts do |b|
    if opts[:bibdata] && (doctype || editorialgroup&.presence? ||
                          ics.any? || commentperiod)
      b.ext do
        b.doctype doctype if doctype
        editorialgroup&.to_xml b
        ics.each { |i| i.to_xml b }
        commentperiod&.to_xml b
      end
    end
  end
end