Class: DeepCover::Reporter::Base
- Inherits:
-
Object
- Object
- DeepCover::Reporter::Base
- Includes:
- Memoize
- Defined in:
- lib/deep_cover/reporter/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #analysis ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(coverage, **options) ⇒ Base
constructor
A new instance of Base.
-
#populate_stats ⇒ Object
Same as populate, but also yields data, which is either the analysis data (for leaves) of the sum of the children (for subtrees).
Methods included from Memoize
Constructor Details
#initialize(coverage, **options) ⇒ Base
Returns a new instance of Base.
13 14 15 16 |
# File 'lib/deep_cover/reporter/base.rb', line 13 def initialize(coverage, **) @coverage = coverage @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/deep_cover/reporter/base.rb', line 11 def @options end |
Instance Method Details
#analysis ⇒ Object
18 19 20 |
# File 'lib/deep_cover/reporter/base.rb', line 18 def analysis @analysis ||= Coverage::Analysis.new(@coverage.covered_codes, **) end |
#each(&block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/deep_cover/reporter/base.rb', line 22 def each(&block) return to_enum :each unless block_given? @coverage.each do |covered_code| yield relative_path(covered_code.path), covered_code end self end |
#populate_stats ⇒ Object
Same as populate, but also yields data, which is either the analysis data (for leaves) of the sum of the children (for subtrees)
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/deep_cover/reporter/base.rb', line 32 def populate_stats return to_enum(__method__) unless block_given? Tree::Util.populate_from_map( tree: tree, map: map, merge: ->(child_data) { Tools.merge(*child_data, :+) } ) do |full_path, partial_path, data, children| yield relative_path(full_path), relative_path(partial_path), data, children end end |