Class: MzID::ParserSax::CounterHandler
- Inherits:
-
Ox::Sax
- Object
- Ox::Sax
- MzID::ParserSax::CounterHandler
- Defined in:
- lib/mzid/parser_sax.rb
Overview
counts the different element types
Constant Summary collapse
- ATTR =
[:DBSequence, :Peptide, :PeptideEvidence, :SpectrumIdentificationItem]
Instance Attribute Summary collapse
-
#dbseq_count ⇒ Object
Returns the value of attribute dbseq_count.
-
#pep_count ⇒ Object
Returns the value of attribute pep_count.
-
#pepev_count ⇒ Object
Returns the value of attribute pepev_count.
-
#spec_count ⇒ Object
Returns the value of attribute spec_count.
Instance Method Summary collapse
-
#initialize ⇒ CounterHandler
constructor
A new instance of CounterHandler.
- #start_element(name) ⇒ Object
Constructor Details
#initialize ⇒ CounterHandler
Returns a new instance of CounterHandler.
18 19 20 21 22 23 |
# File 'lib/mzid/parser_sax.rb', line 18 def initialize() @dbseq_count = 0 @pep_count = 0 @pepev_count = 0 @spec_count = 0 end |
Instance Attribute Details
#dbseq_count ⇒ Object
Returns the value of attribute dbseq_count.
24 25 26 |
# File 'lib/mzid/parser_sax.rb', line 24 def dbseq_count @dbseq_count end |
#pep_count ⇒ Object
Returns the value of attribute pep_count.
24 25 26 |
# File 'lib/mzid/parser_sax.rb', line 24 def pep_count @pep_count end |
#pepev_count ⇒ Object
Returns the value of attribute pepev_count.
24 25 26 |
# File 'lib/mzid/parser_sax.rb', line 24 def pepev_count @pepev_count end |
#spec_count ⇒ Object
Returns the value of attribute spec_count.
24 25 26 |
# File 'lib/mzid/parser_sax.rb', line 24 def spec_count @spec_count end |
Instance Method Details
#start_element(name) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/mzid/parser_sax.rb', line 26 def start_element(name) return unless ATTR.include?(name) case name when :DBSequence @dbseq_count += 1 when :Peptide @pep_count += 1 when :PeptideEvidence @pepev_count += 1 when :SpectrumIdentificationItem @spec_count += 1 end end |