Module: SimpleCov::Combine::InternedCounts
- Defined in:
- lib/simplecov/combine/interned_counts.rb
Overview
The inner merge loop the branches and methods combiners share:
fold source's tuple => count pairs into target, an interned
table keyed by each tuple's merge identity and holding
[raw_key, count] pairs. The first-seen raw key is kept for
display; counts sum. target and its pairs are always built by
this loop, so updating them in place can't reach data a caller
still holds.
Class Method Summary collapse
Class Method Details
.absorb_counts(target, source, identities) ⇒ Hash
Returns target.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/simplecov/combine/interned_counts.rb', line 16 def absorb_counts(target, source, identities) source.each do |key, count| interned = identities[key] entry = target[interned] if entry entry[1] += count else target[interned] = [key, count] end end target end |