class SimpleCov::Sublime::ResultWrapper
Representation of the simplecov result including it's coverage data, source code, source lines and featuring helpers to interpret that data.
@author Mikael Henriksson <mikael@mhenrixon.com>
Attributes
result[R]
Public Class Methods
new(result)
click to toggle source
Wrap the SimpleCov::Result to enable hash conversion without monkey patching
@param [SimpleCov::Result] result the simplecov result to generate hash for
# File lib/simple_cov/sublime/result_wrapper.rb, line 17 def initialize(result) @result = result end
Public Instance Methods
to_h()
click to toggle source
Returns a nicely formatted hash from the simplecov result data
@return [Hash]
# File lib/simple_cov/sublime/result_wrapper.rb, line 27 def to_h { covered_percent: covered_percent, covered_strength: covered_strength, covered_lines: covered_lines, total_lines: total_lines } end
Private Instance Methods
covered_lines()
click to toggle source
@private
# File lib/simple_cov/sublime/result_wrapper.rb, line 53 def covered_lines result.covered_lines end
covered_percent()
click to toggle source
@private
# File lib/simple_cov/sublime/result_wrapper.rb, line 48 def covered_percent result.covered_percent end
covered_strength()
click to toggle source
@private
# File lib/simple_cov/sublime/result_wrapper.rb, line 41 def covered_strength return 0.0 unless (coverage = result.covered_strength) coverage.nan? ? 0.0 : coverage end
total_lines()
click to toggle source
@private
# File lib/simple_cov/sublime/result_wrapper.rb, line 58 def total_lines result.total_lines end