Sha256: d4b6bba49658da9b29026e2ce51966bef7911306dbd27fdd62daf4f9721eb5e2

Contents?: true

Size: 848 Bytes

Versions: 12

Compression:

Stored size: 848 Bytes

Contents

require 'mspire/paramable'
require 'mspire/mzml/list'

module Mspire
  class Mzml
    class Sample
      include Mspire::Paramable
      extend Mspire::Mzml::List

      # A unique identifier across the samples with which to reference this sample description.
      attr_accessor :id

      # An optional name for the sample description, mostly intended as a quick mnemonic.
      attr_accessor :name

      def initialize(id)
        @id = id
        params_init
        yield(self) if block_given?
      end

      def to_xml(builder)
        builder.sample( id: @id, name: @name ) do |sample_n|
          super(sample_n)
        end
        builder
      end

      def self.from_xml(xml, link)
        obj = self.new(xml[:id])
        obj.name = xml[:name]
        obj.describe_self_from_xml!(xml, link[:ref_hash])
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mspire-0.10.8.0 lib/mspire/mzml/sample.rb
mspire-0.10.7.3 lib/mspire/mzml/sample.rb
mspire-0.10.7.2 lib/mspire/mzml/sample.rb
mspire-0.10.7.1 lib/mspire/mzml/sample.rb
mspire-0.10.7 lib/mspire/mzml/sample.rb
mspire-0.10.6 lib/mspire/mzml/sample.rb
mspire-0.10.5 lib/mspire/mzml/sample.rb
mspire-0.10.4 lib/mspire/mzml/sample.rb
mspire-0.10.3 lib/mspire/mzml/sample.rb
mspire-0.10.2 lib/mspire/mzml/sample.rb
mspire-0.10.1 lib/mspire/mzml/sample.rb
mspire-0.10.0 lib/mspire/mzml/sample.rb