Class: Dexter::CsvLogParser
- Defined in:
- lib/dexter/parsers/csv_log_parser.rb
Constant Summary collapse
- FIRST_LINE_REGEX =
/\A.+/
Constants inherited from LogParser
Instance Method Summary collapse
Methods inherited from LogParser
Constructor Details
This class inherits a constructor from Dexter::LogParser
Instance Method Details
#perform(collector) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dexter/parsers/csv_log_parser.rb', line 5 def perform(collector) CSV.new(@logfile.to_io).each do |row| = row[13] detail = row[14] if (m = REGEX.match()) # replace first line with match # needed for multiline queries active_line = .sub(FIRST_LINE_REGEX, m[3]) add_parameters(active_line, detail) if detail collector.add(active_line, m[1].to_f) end end rescue CSV::MalformedCSVError => e raise Error, "ERROR: #{e.message}" ensure @logfile.close end |