Sha256: 5e17c84d839c6e7d677d3f2382faaf379ad7adbe16ca9ba1bbd51658f59686a0
Contents?: true
Size: 989 Bytes
Versions: 3
Compression:
Stored size: 989 Bytes
Contents
module CukeCataloger # Not a part of the public API. Subject to change at any time. class TextReportFormatter # Formats validation results into a readable text report def format_data(data) report_text = "Validation Results\nProblems found: #{data.count}\n\n" results_by_category = Hash.new { |hash, key| hash[key] = [] } data.each do |result| results_by_category[result[:problem]] << result end results_by_category.keys.each do |problem_category| report_text << "#{problem_category} problems: #{results_by_category[problem_category].count}\n" end results_by_category.keys.each do |problem_category| report_text << "\n\n#{problem_category} problems (#{results_by_category[problem_category].count}):\n" results_by_category[problem_category].each do |result| report_text << "#{result[:test]}\n" end end report_text end end end
Version data entries
3 entries across 3 versions & 1 rubygems