Class: See5::GritbotOutputParser
- Inherits:
-
Object
- Object
- See5::GritbotOutputParser
- Defined in:
- lib/see5/gritbot_output_parser.rb
Overview
Read Gritbot output and return an array of hashes representing the anomalies
Instance Attribute Summary collapse
-
#anomalies ⇒ Object
readonly
Returns the value of attribute anomalies.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(fname) ⇒ GritbotOutputParser
constructor
A new instance of GritbotOutputParser.
- #parse_file ⇒ Object
Constructor Details
#initialize(fname) ⇒ GritbotOutputParser
Returns a new instance of GritbotOutputParser.
12 13 14 15 16 17 |
# File 'lib/see5/gritbot_output_parser.rb', line 12 def initialize(fname) @file = File.open(fname) @anomalies = [] parse_file end |
Instance Attribute Details
#anomalies ⇒ Object (readonly)
Returns the value of attribute anomalies.
6 7 8 |
# File 'lib/see5/gritbot_output_parser.rb', line 6 def anomalies @anomalies end |
Class Method Details
.parse_file(fname) ⇒ Object
8 9 10 |
# File 'lib/see5/gritbot_output_parser.rb', line 8 def self.parse_file(fname) new(fname).anomalies end |
Instance Method Details
#parse_file ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/see5/gritbot_output_parser.rb', line 19 def parse_file discard_header while (line = lines.next) if line.start_with?(/\s*while checking/) # TODO record excluded cases elsif line.start_with?(/(:?test |data )?case /) @anomalies << parse_anomaly(line) elsif line.start_with?("Time:") break end end end |