Class: Spec::MzXML::REXMLStreamListener::PrecMzByNum

Inherits:
Object
  • Object
show all
Includes:
REXML::StreamListener
Defined in:
lib/spec/mzxml/parser.rb

Overview

for REXML

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePrecMzByNum

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_mzObject

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