Class: Spec::MzXML::REXMLStreamListener::PrecMzByNum
- Inherits:
-
Object
- Object
- Spec::MzXML::REXMLStreamListener::PrecMzByNum
- Includes:
- REXML::StreamListener
- Defined in:
- lib/spec/mzxml/parser.rb
Overview
for REXML
Instance Attribute Summary collapse
-
#prec_mz ⇒ Object
Returns the value of attribute prec_mz.
Instance Method Summary collapse
-
#initialize ⇒ PrecMzByNum
constructor
A new instance of PrecMzByNum.
- #tag_end(name) ⇒ Object
- #tag_start(name, attrs) ⇒ Object
- #text(txt) ⇒ Object
Constructor Details
#initialize ⇒ PrecMzByNum
Returns a new instance of PrecMzByNum.
33 34 35 36 37 |
# File 'lib/spec/mzxml/parser.rb', line 33 def initialize @prec_mz = [] @scan_num = nil @get_data = false end |
Instance Attribute Details
#prec_mz ⇒ Object
Returns the value of attribute prec_mz.
31 32 33 |
# File 'lib/spec/mzxml/parser.rb', line 31 def prec_mz @prec_mz end |
Instance Method Details
#tag_end(name) ⇒ Object
47 48 49 50 51 |
# File 'lib/spec/mzxml/parser.rb', line 47 def tag_end(name) if name == "precursorMz" @get_data = false end end |
#tag_start(name, attrs) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/spec/mzxml/parser.rb', line 39 def tag_start(name,attrs) if name == "scan" @scan_num = attrs["num"].to_i elsif name == "precursorMz" @get_data = true end end |
#text(txt) ⇒ Object
53 54 55 56 57 |
# File 'lib/spec/mzxml/parser.rb', line 53 def text(txt) if @get_data @prec_mz[@scan_num] = txt end end |