Class: Uncov::Report::File

Inherits:
Object
  • Object
show all
Includes:
Cache
Defined in:
lib/uncov/report/file.rb

Overview

represents file coverage in report

Defined Under Namespace

Classes: Line

Instance Method Summary collapse

Instance Method Details

#coverageObject



7
8
9
10
11
12
13
14
15
# File 'lib/uncov/report/file.rb', line 7

def coverage
  cache(:coverage) do
    if relevant_lines_count.zero?
      100.0
    else
      (covered_lines_count.to_f / relevant_lines_count * 100).round(2)
    end
  end
end

#covered_lines_countObject



27
28
29
30
31
# File 'lib/uncov/report/file.rb', line 27

def covered_lines_count
  cache(:covered_lines_count) do
    lines.count(&:covered?)
  end
end

#display?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/uncov/report/file.rb', line 23

def display?
  display_lines.any?
end

#display_linesObject



33
34
35
36
37
# File 'lib/uncov/report/file.rb', line 33

def display_lines
  cache(:display_lines) do
    lines.select(&:display?)
  end
end

#relevant_lines_countObject



39
40
41
42
43
# File 'lib/uncov/report/file.rb', line 39

def relevant_lines_count
  cache(:relevant_lines_count) do
    lines.count(&:relevant?)
  end
end

#trigger?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/uncov/report/file.rb', line 17

def trigger?
  cache(:trigger) do
    lines.any?(&:trigger?)
  end
end