Sha256: 2e1113d6bbff9cb1777369a32e0dd61f09a1d157b607363fa2c6b946bf98ee54

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

module RelatonIho
  class IhoBibliographicItem < RelatonBib::BibliographicItem
    TYPES = %w[policy-and-procedures best-practices supporting-document
               report legal directives proposal standard].freeze

    # @return [RelatonIho::CommentPeriod, NilClass]
    attr_reader :commentperiod

    # @param editorialgroup [RelatonIho::EditorialGroupCollection]
    # @param commentperiod [RelatonIho::CommentPeriod, NilClass]
    def initialize(**args)
      @commentperiod = args.delete :commentperiod
      super
    end

    # @param opts [Hash]
    # @option opts [Nokogiri::XML::Builder] :builder XML builder
    # @option opts [Boolean] :bibdata
    # @option opts [String] :lang language
    # @return [String] XML
    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

    # @return [Hash]
    def to_hash
      hash = super
      hash["commentperiod"] = commentperiod.to_hash if commentperiod
      hash
    end

    # @param prefix [String]
    # @return [String]
    def to_asciibib(prefix = "")
      out = super
      out += commentperiod.to_asciibib prefix if commentperiod
      out
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
relaton-iho-1.7.1 lib/relaton_iho/iho_bibliographic_item.rb
relaton-iho-1.7.0 lib/relaton_iho/iho_bibliographic_item.rb
relaton-iho-1.6.0 lib/relaton_iho/iho_bibliographic_item.rb
relaton-iho-1.6.pre1 lib/relaton_iho/iho_bibliographic_item.rb
relaton-iho-1.5.0 lib/relaton_iho/iho_bibliographic_item.rb
relaton-iho-1.5.pre lib/relaton_iho/iho_bibliographic_item.rb