Module: DeepCover::Tools::Format

Defined in:
lib/deep_cover/tools/format.rb

Constant Summary collapse

CONVERT =
Hash.new('  ')

Instance Method Summary collapse

Instance Method Details

#format(*results, filename: nil, source: nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/deep_cover/tools/format.rb', line 9

def format(*results, filename: nil, source: nil)
  source ||= File.read(filename)
  results.map! { |counts| counts.map { |c| CONVERT[c] } }
  [*results, source.lines].transpose.map do |parts|
    *line_results, line = parts
    Term::ANSIColor.white(line_results.join) + line.to_s
  end
end