Sha256: f2f42253281bdecb0337df765416cb6f607bd707e3e765a6eee5a7c694d07f6a

Contents?: true

Size: 1.24 KB

Versions: 16

Compression:

Stored size: 1.24 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 hash [Hash]
    # @return [RelatonIeee::IeeeBibliographicItem]
    def self.from_hash(hash)
      item_hash = ::RelatonIeee::HashConverter.hash_to_bib(hash)
      new(**item_hash)
    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 if committee.any?
      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

16 entries across 16 versions & 1 rubygems

Version Path
relaton-ieee-1.12.4 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.12.3 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.12.2 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.12.1 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.12.0 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.11.3 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.11.2 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.11.1 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.11.0 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.10.2 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.10.1 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.10.0 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.9.4 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.9.3 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.9.2 lib/relaton_ieee/ieee_bibliographic_item.rb
relaton-ieee-1.9.1 lib/relaton_ieee/ieee_bibliographic_item.rb