Class: GCOV::ANSIIFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/ansii_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ ANSIIFormatter

Returns a new instance of ANSIIFormatter.



12
13
14
# File 'lib/ansii_formatter.rb', line 12

def initialize project
  @project = project
end

Instance Method Details



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ansii_formatter.rb', line 16

def print
  
  @project.files.each do |file|
    puts "#{white}#{bold}=== #{file.meta['Source']} ===#{reset}"
    file.lines.select{|line| line.number > 0}.each do |line|
      col = case line.count
            when :none then dark+white
            when :missed then black+on_red
            else green
            end
      puts col + line.text + reset
    end
  end

end