Sha256: ef16d2f4a7ffaad876965ff5d0418b31a454ec8aac9614f266c652703eb74f7e

Contents?: true

Size: 1023 Bytes

Versions: 11

Compression:

Stored size: 1023 Bytes

Contents

require 'ms/cv/paramable'

module MS
  class Mzml

    # need to call to_xml_definition (or use
    # MS::Mzml::ReferenceableParamGroupList.list_xml) to get the xml for the
    # object itself (and not a reference).  Merely callying #to_xml will
    # result in a referenceableParamGroupRef being created.
    class ReferenceableParamGroup
      include MS::CV::Paramable

      attr_accessor :id

      def initialize(id, opts={params: []} )
        @id = id
        describe!(*opts[:params])
      end

      def to_xml(builder)
        builder.referenceableParamGroupRef(ref: @id)
        builder
      end

      def to_xml_definition(builder)
        builder.referenceableParamGroup(id: @id) do |fc_n|
          @params.each {|obj| obj.to_xml(fc_n) }
        end
        builder
      end

      def self.list_xml(objs, builder)
        builder.referenceableParamGroupList(count: objs.size) do |rpgl_n|
          objs.each {|obj| obj.to_xml_definition(rpgl_n) }
        end
        builder
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mspire-0.6.26 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.25 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.24 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.22 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.21 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.20 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.19 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.18 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.12 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.11 lib/ms/mzml/referenceable_param_group.rb
mspire-0.6.9 lib/ms/mzml/referenceable_param_group.rb