Class: RelatonIho::IhoBibliographicItem

Inherits:
RelatonBib::BibliographicItem
  • Object
show all
Defined in:
lib/relaton_iho/iho_bibliographic_item.rb

Constant Summary collapse

TYPES =
%w[policy-and-procedures best-practices supporting-document
report legal directives proposal standard].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ IhoBibliographicItem

Returns a new instance of IhoBibliographicItem.

Parameters:



11
12
13
14
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 11

def initialize(**args)
  @commentperiod = args.delete :commentperiod
  super
end

Instance Attribute Details

#commentperiodRelatonIho::CommentPeriod, NilClass (readonly)

Returns:

  • (RelatonIho::CommentPeriod, NilClass)


7
8
9
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 7

def commentperiod
  @commentperiod
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


34
35
36
37
38
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 34

def to_hash
  hash = super
  hash["commentperiod"] = commentperiod.to_hash if commentperiod
  hash
end

#to_xml(builer = nil, **opts) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)
  • bibdata (TrueClasss, FalseClass, NilClass)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/relaton_iho/iho_bibliographic_item.rb', line 18

def to_xml(builer = nil, **opts)
  opts[:ext] = !commentperiod.nil?
  super 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