Sha256: 5dfc93cf166241fb811eecf757281f1ec86327dc64b66157c6b458f16fc50072

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

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
    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)
      super **opts 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

    # @param prefix [String]
    # @return [String]
    def to_asciibib(prefix = "")
      out = super
      committee.each { |c| out += c.to_asciibib prefix, committee.size }
      out
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
relaton-ieee-1.7.2 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.7.1 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.7.0 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.6.0 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.6.pre1 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.5.0 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.5.pre lib/relaton_ieee/ieee_bibliographic_item.rb