Class: CoverUp::FileResult
- Inherits:
-
Object
- Object
- CoverUp::FileResult
- Defined in:
- lib/cover-up.rb
Overview
This tracks coverage results for an individual file
Instance Attribute Summary collapse
-
#excluded ⇒ Object
Returns the value of attribute excluded.
-
#hit ⇒ Object
Returns the value of attribute hit.
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#missed ⇒ Object
Returns the value of attribute missed.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#hit_percentage ⇒ Object
This calculates the percentage of lines that were hit by the code being covered.
-
#initialize(name, lines, hit, missed, excluded) ⇒ FileResult
constructor
This initializes the file result with the amount of lines, and the hit/missed/excluded lines for the file, along with the name.
-
#lines_without_exclusions ⇒ Object
This returns the amount of lines after the excluded lines have been removed.
-
#missed_percentage ⇒ Object
This calculates the percentage of lines that were missed by the code being covered.
Constructor Details
#initialize(name, lines, hit, missed, excluded) ⇒ FileResult
This initializes the file result with the amount of lines, and the hit/missed/excluded lines for the file, along with the name
45 46 47 48 49 50 51 |
# File 'lib/cover-up.rb', line 45 def initialize(name, lines, hit, missed, excluded) self.name = name self.lines = lines self.hit = hit self.missed = missed self.excluded = excluded end |
Instance Attribute Details
#excluded ⇒ Object
Returns the value of attribute excluded.
42 43 44 |
# File 'lib/cover-up.rb', line 42 def excluded @excluded end |
#hit ⇒ Object
Returns the value of attribute hit.
42 43 44 |
# File 'lib/cover-up.rb', line 42 def hit @hit end |
#lines ⇒ Object
Returns the value of attribute lines.
42 43 44 |
# File 'lib/cover-up.rb', line 42 def lines @lines end |
#missed ⇒ Object
Returns the value of attribute missed.
42 43 44 |
# File 'lib/cover-up.rb', line 42 def missed @missed end |
#name ⇒ Object
Returns the value of attribute name.
42 43 44 |
# File 'lib/cover-up.rb', line 42 def name @name end |
Instance Method Details
#hit_percentage ⇒ Object
This calculates the percentage of lines that were hit by the code being covered
59 60 61 62 |
# File 'lib/cover-up.rb', line 59 def hit_percentage return 0 if self.lines_with_exclusions.to_f == 0.0 (self.hit.length.to_f / self.lines_with_exclusions.to_f) * 100.0 end |
#lines_without_exclusions ⇒ Object
This returns the amount of lines after the excluded lines have been removed
54 55 56 |
# File 'lib/cover-up.rb', line 54 def lines_without_exclusions self.lines - excluded.length end |
#missed_percentage ⇒ Object
This calculates the percentage of lines that were missed by the code being covered
65 66 67 68 |
# File 'lib/cover-up.rb', line 65 def missed_percentage return 0 if self.lines_with_exclusions.to_f == 0.0 (self.missed.length.to_f / self.lines_with_exclusions.to_f) * 100.0 end |