Sha256: 1237db58ad65472f1e2f5248ae9a666a8461e803911c2654c66747a588c46221

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

module RelatonBipm
  class EditorialGroup
    include RelatonBib

    # @return [Array<String>]
    attr_reader :committee, :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
      {
        "committee" => single_element_array(committee),
        "workgroup" => single_element_array(workgroup),
      }
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
relaton-bipm-1.8.2 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.8.1 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.8.0 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.7.2 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.7.1 lib/relaton_bipm/editorial_group.rb
relaton-bipm-1.7.0 lib/relaton_bipm/editorial_group.rb