Class: Mspire::Mzml::Sample

Inherits:
Object
  • Object
show all
Extended by:
List
Includes:
CV::Paramable
Defined in:
lib/mspire/mzml/sample.rb

Instance Attribute Summary collapse

Attributes included from CV::Paramable

#params

Instance Method Summary collapse

Methods included from List

list_xml, list_xml_element

Methods included from CV::Paramable

#describe!, #describe_many!, #find_param_by_accession, #find_param_value_by_accession, #param_exists_by_accession?

Constructor Details

#initialize(id, name, opts = {params: []}, &block) ⇒ Sample

Returns a new instance of Sample.



11
12
13
14
15
# File 'lib/mspire/mzml/sample.rb', line 11

def initialize(id, name, opts={params: []}, &block)
  @id, @name = id, name
  describe_many!(opts[:params])
  block.call(self) if block
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/mspire/mzml/sample.rb', line 9

def id
  @id
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/mspire/mzml/sample.rb', line 9

def name
  @name
end

Instance Method Details

#to_xml(builder) ⇒ Object



17
18
19
20
21
22
# File 'lib/mspire/mzml/sample.rb', line 17

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