Module: SimpleCov::Formatter::Console::TableOutput
- Defined in:
- lib/simplecov-console/output/table.rb
Instance Method Summary collapse
-
#output(files, root, show_branch) ⇒ Object
format per-file results output using Terminal::Table.
Instance Method Details
#output(files, root, show_branch) ⇒ Object
format per-file results output using Terminal::Table
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/simplecov-console/output/table.rb', line 7 def output(files, root,show_branch) table = files.map do |f| row = [ colorize(pct(f.covered_percent)), f.filename.gsub(root + "/", ''), f.lines_of_code, f.missed_lines.count, trunc(missed(f.missed_lines).join(", ")), ] if show_branch row += [ colorize(pct(f.coverage_statistics[:branch].percent)), f.total_branches.count, f.missed_branches.count, branches_missed(f.missed_branches).join(", ") ] end row end = SimpleCov::Formatter::Console. || {} if !.kind_of?(Hash) then raise ArgumentError.new("SimpleCov::Formatter::Console.table_options must be a Hash") end headings = %w{ coverage file lines missed missing } if show_branch headings += [ 'branch coverage', 'branches', 'branches missed', 'branches missing' ] end opts = .merge({:headings => headings, :rows => table}) Terminal::Table.new(opts) end |