Class: Lemon::CoverReports::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/lemon/coverage/formats/abstract.rb

Direct Known Subclasses

Compact, Outline, Verbose, Yaml

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(coverage) ⇒ Abstract

Returns a new instance of Abstract.



7
8
9
# File 'lib/lemon/coverage/formats/abstract.rb', line 7

def initialize(coverage)
  @coverage  = coverage
end

Instance Attribute Details

#coverageObject (readonly)

Returns the value of attribute coverage.



12
13
14
# File 'lib/lemon/coverage/formats/abstract.rb', line 12

def coverage
  @coverage
end

Instance Method Details

#covered_unitsObject



18
19
20
# File 'lib/lemon/coverage/formats/abstract.rb', line 18

def covered_units
  coverage.covered
end

#renderObject



15
16
# File 'lib/lemon/coverage/formats/abstract.rb', line 15

def render
end

#tallyObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/lemon/coverage/formats/abstract.rb', line 35

def tally
  c = covered_units.size
  u = uncovered_units.size
  t = c + u

  pc = c * 100 / t
  pu = u * 100 / t

  "#{pc}% #{c}/#{t} covered, #{pu}% #{u}/#{t} uncovered" + 
  " (#{undefined_units.size} undefined units, #{uncovered_cases.size} uncovered cases)"
end

#uncovered_casesObject



30
31
32
# File 'lib/lemon/coverage/formats/abstract.rb', line 30

def uncovered_cases
  coverage.uncovered_cases
end

#uncovered_unitsObject



22
23
24
# File 'lib/lemon/coverage/formats/abstract.rb', line 22

def uncovered_units
  coverage.uncovered
end

#undefined_unitsObject



26
27
28
# File 'lib/lemon/coverage/formats/abstract.rb', line 26

def undefined_units
  coverage.undefined
end