Class: Mspire::Mzml::FileDescription
- Inherits:
-
Object
- Object
- Mspire::Mzml::FileDescription
- Defined in:
- lib/mspire/mzml/file_description.rb
Instance Attribute Summary collapse
-
#contacts ⇒ Object
zero to many (just listed in the singular, not enclosed in a list).
-
#file_content ⇒ Object
a summary of the different types of spectra, must be present.
-
#source_files ⇒ Object
may or may not be present.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file_content = nil, source_files = [], contacts = [], &block) ⇒ FileDescription
constructor
hands the user the object if given a block.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(file_content = nil, source_files = [], contacts = [], &block) ⇒ FileDescription
hands the user the object if given a block
24 25 26 27 28 |
# File 'lib/mspire/mzml/file_description.rb', line 24 def initialize(file_content=nil, source_files=[], contacts=[], &block) @file_content, @source_files, @contacts = file_content, source_files, contacts block.call(self) if block #raise ArgumentError, "FileDescription must have file_content" unless @file_content end |
Instance Attribute Details
#contacts ⇒ Object
zero to many (just listed in the singular, not enclosed in a list)
<contact>
</contact>
<contact>
</contact>
21 22 23 |
# File 'lib/mspire/mzml/file_description.rb', line 21 def contacts @contacts end |
#file_content ⇒ Object
a summary of the different types of spectra, must be present
10 11 12 |
# File 'lib/mspire/mzml/file_description.rb', line 10 def file_content @file_content end |
#source_files ⇒ Object
may or may not be present
13 14 15 |
# File 'lib/mspire/mzml/file_description.rb', line 13 def source_files @source_files end |
Class Method Details
.from_xml(xml) ⇒ Object
30 31 32 |
# File 'lib/mspire/mzml/file_description.rb', line 30 def self.from_xml(xml) self.new end |
Instance Method Details
#to_xml(builder) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mspire/mzml/file_description.rb', line 34 def to_xml(builder) builder.fileDescription do |fd_n| @file_content.to_xml(fd_n) if source_files.size > 0 fd_n.sourceFileList(count: source_files.size) do |sf_n| source_files.each do |sf| sf.to_xml(sf_n) end end end contacts.each do |contact| contact.to_xml(fd_n) end end end |