Class: CoverageItem
- Inherits:
-
Object
- Object
- CoverageItem
- Defined in:
- lib/cobertura/coverage_item.rb
Overview
Container item for cobertura <class> entries
Instance Method Summary collapse
-
#branch_rate ⇒ Float
The branch coverage rate.
-
#filename ⇒ String
Name of the class file with directory path.
-
#initialize(node) ⇒ CoverageItem
constructor
Initialize an object using an xml node set containing the class information of a cobertura report.
-
#line_rate ⇒ Float
The line coverage rate.
-
#name ⇒ String
Name of the class file with package structure.
-
#total_percentage ⇒ Float
The combined coverage of branch and line rate.
Constructor Details
#initialize(node) ⇒ CoverageItem
Initialize an object using an xml node set containing the class information of a cobertura report.
6 7 8 |
# File 'lib/cobertura/coverage_item.rb', line 6 def initialize(node) @node = node end |
Instance Method Details
#branch_rate ⇒ Float
Returns The branch coverage rate.
16 17 18 |
# File 'lib/cobertura/coverage_item.rb', line 16 def branch_rate @branch_rate ||= @node.attribute("branch-rate").value.to_f * 100 end |
#filename ⇒ String
Returns Name of the class file with directory path.
26 27 28 |
# File 'lib/cobertura/coverage_item.rb', line 26 def filename @filename ||= @node.attribute("filename").value.to_s end |
#line_rate ⇒ Float
Returns The line coverage rate.
21 22 23 |
# File 'lib/cobertura/coverage_item.rb', line 21 def line_rate @line_rate ||= @node.attribute("line-rate").value.to_f * 100 end |
#name ⇒ String
Returns Name of the class file with package structure.
31 32 33 |
# File 'lib/cobertura/coverage_item.rb', line 31 def name @name ||= @node.attribute("name").value.to_s end |
#total_percentage ⇒ Float
Returns The combined coverage of branch and line rate.
11 12 13 |
# File 'lib/cobertura/coverage_item.rb', line 11 def total_percentage @total_percentage ||= (branch_rate + line_rate) / 2 end |