Sha256: 0a6f4ef77624c65a79edaf3d3e866686dcb02c9007f2633817e822b3a2738538

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

module RelatonIeee
  class IeeeBibliographicItem < RelatonBib::BibliographicItem
    # @return [Array<RelatonIeee::Committee>]
    attr_reader :committee

    # @param committee [Array<RelatonIeee::Committee>]
    def initialize(**args)
      @committee = args.delete :committee
      super
      # @doctype = args[:doctyp]
    end

    # @param builder [Nokogiri::XML::Bilder]
    # @parma bibdata [TrueClass, FalseClass, NilClass]
    def to_xml(builder = nil, **opts)
      super do |bldr|
        if opts[:bibdata] && committee.any?
          bldr.ext do |b|
            committee.each { |c| c.to_xml b }
          end
        end
      end
    end

    # @return [Hash]
    def to_hash
      hash = super
      hash["committee"] = committee.map &:to_hash
      hash
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/relaton-ieee-1.2.0/lib/relaton_ieee/ieee_bibliographic_item.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/relaton-ieee-1.2.0/lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.2.0 lib/relaton_ieee/ieee_bibliographic_item.rb