Module: TestResultsParser::Parser
- Defined in:
- lib/modules/test_results_parser.rb
Instance Method Summary collapse
Instance Method Details
#parse_test_results(filepath, error_limit = 0.05) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/modules/test_results_parser.rb', line 8 def parse_test_results(filepath, error_limit=0.05) total, correct = 0.0, 0.0 File.open(filepath) do |f| while line = f.gets do next if line.match(/ID/) error = line.match(/\t(\d+\..+)$/)[1] total += 1 if error.to_f < error_limit correct += 1 end end #while end #File.open correct / total * 100 end |