Sha256: 7780bd36690c0f07f640ce084fefdd6d23e5af2cb01bdb28f52b9b4b843b62db

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

require 'mspire/cv/paramable'

module Mspire
  class Mzml

    # need to call to_xml_definition (or use
    # Mspire::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 Mspire::CV::Paramable

      attr_accessor :id

      def initialize(id)
        @id = id
        params_init
        yield(self) if block_given?
      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.from_xml(xml)
        obj = self.new(xml[:id])
        obj.describe_from_xml!(xml)
        obj
      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

13 entries across 13 versions & 1 rubygems

Version Path
mspire-0.9.2 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.9.1 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.9.0 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.7 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.6.2 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.6.1 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.6 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.5 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.4 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.3 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.2 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.1 lib/mspire/mzml/referenceable_param_group.rb
mspire-0.8.0 lib/mspire/mzml/referenceable_param_group.rb