Class: Mspire::Mzml::Sample
- Inherits:
-
Object
- Object
- Mspire::Mzml::Sample
- Extended by:
- List
- Includes:
- Paramable
- Defined in:
- lib/mspire/mzml/sample.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
A unique identifier across the samples with which to reference this sample description.
-
#name ⇒ Object
An optional name for the sample description, mostly intended as a quick mnemonic.
Attributes included from Paramable
#cv_params, #ref_param_groups, #user_params
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id) {|_self| ... } ⇒ Sample
constructor
A new instance of Sample.
- #to_xml(builder) ⇒ Object
Methods included from List
Methods included from Paramable
#accessionable_params, #describe!, #describe_from_xml!, #describe_many!, #describe_self_from_xml!, #each_accessionable_param, #each_param, #fetch, #fetch_by_accession, #param?, #param_by_accession, #params, #params?, #reject!, #replace!, #replace_many!
Constructor Details
#initialize(id) {|_self| ... } ⇒ Sample
Returns a new instance of Sample.
16 17 18 19 20 |
# File 'lib/mspire/mzml/sample.rb', line 16 def initialize(id) @id = id params_init yield(self) if block_given? end |
Instance Attribute Details
#id ⇒ Object
A unique identifier across the samples with which to reference this sample description.
11 12 13 |
# File 'lib/mspire/mzml/sample.rb', line 11 def id @id end |
#name ⇒ Object
An optional name for the sample description, mostly intended as a quick mnemonic.
14 15 16 |
# File 'lib/mspire/mzml/sample.rb', line 14 def name @name end |
Class Method Details
.from_xml(xml, link) ⇒ Object
29 30 31 32 33 |
# File 'lib/mspire/mzml/sample.rb', line 29 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 |
Instance Method Details
#to_xml(builder) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/mspire/mzml/sample.rb', line 22 def to_xml(builder) builder.sample( id: @id, name: @name ) do |sample_n| super(sample_n) end builder end |