Sha256: 7a0800c68d8867c67cef6437bd527d4984a2be2c3ec210d22044f8cc7f58b1a4

Contents?: true

Size: 1.29 KB

Versions: 38

Compression:

Stored size: 1.29 KB

Contents

module RelatonBipm
  class EditorialGroup
    include RelatonBib

    # @return [Array<RelatonBipm::Committee>]
    attr_reader :committee

    # @return [Array<RelatonBipm::WorkGroup>]
    attr_reader :workgroup

    # @param committee [Array<RelatonBipm::Committee>]
    # @param workgroup [Array<RelatonBipm::WorkGroup>]
    def initialize(committee:, workgroup: [])
      @committee = committee
      @workgroup = workgroup
    end

    # @param builder [Nokogiri::XML::Builder]
    def to_xml(builder)
      builder.editorialgroup do |b|
        committee.each { |c| c.to_xml b }
        workgroup.each { |c| c.to_xml b }
      end
    end

    # @param prefix [String]
    # @return [String]
    def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize
      pref = prefix.empty? ? prefix : "#{prefix}."
      pref += "editorialgroup"
      out = ""
      committee.each { |c| out += c.to_asciibib pref, committee.size }
      workgroup.each { |w| out += w.to_asciibib pref, workgroup.size }
      out
    end

    # @return [Hash]
    def to_hash
      hash = {}
      hash["committee"] = single_element_array(committee) if committee.any?
      hash["workgroup"] = single_element_array(workgroup) if workgroup.any?
      hash
    end

    # @return [true]
    def presence?
      true
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
relaton-bipm-1.20.3 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.20.2 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.19.4 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.20.1 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.19.3 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.20.0.v1.19.3.1 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.20.0 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.19.2 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.19.1 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.19.0 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.18.2 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.18.1 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.18.0 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.17.1 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.17.0 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.16.6 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.16.5 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.16.4 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.16.3 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.16.2 lib/relaton_bipm/editorial_group.rb