class CoverageItem

Container item for cobertura <class> entries

Public Class Methods

new(node) click to toggle source

Initialize an object using an xml node set containing the class information of a cobertura report.

@param node [Oga::XML::NodeSet] NodeSet of a class

# File lib/cobertura/coverage_item.rb, line 6
def initialize(node)
  @node = node
end

Public Instance Methods

branch_rate() click to toggle source

@return [Float] The branch coverage rate

# File lib/cobertura/coverage_item.rb, line 16
def branch_rate
  @branch_rate ||= @node.attribute("branch-rate").value.to_f * 100
end
filename() click to toggle source

@return [String] Name of the class file with directory path

# File lib/cobertura/coverage_item.rb, line 26
def filename
  @filename ||= @node.attribute("filename").value.to_s
end
line_rate() click to toggle source

@return [Float] The line coverage rate

# File lib/cobertura/coverage_item.rb, line 21
def line_rate
  @line_rate ||= @node.attribute("line-rate").value.to_f * 100
end
name() click to toggle source

@return [String] Name of the class file with package structure

# File lib/cobertura/coverage_item.rb, line 31
def name
  @name ||= @node.attribute("name").value.to_s
end
total_percentage() click to toggle source

@return [Float] The combined coverage of branch and line rate

# File lib/cobertura/coverage_item.rb, line 11
def total_percentage
  @total_percentage ||= (branch_rate + line_rate) / 2
end