Class: RSpec::Covers::Tracer::Dynamic
- Inherits:
-
Object
- Object
- RSpec::Covers::Tracer::Dynamic
- Defined in:
- lib/rspec/covers/tracer/dynamic.rb
Instance Method Summary collapse
Instance Method Details
#score(example:, call_log:, candidates:, corpus: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rspec/covers/tracer/dynamic.rb', line 7 def score(example:, call_log:, candidates:, corpus: nil, **) return corpus_score(example, candidates, corpus) if corpus counts = call_log&.labels&.tally || {} max_count = counts.values.max.to_f candidates.each_with_object({}) do |candidate, scores| scores[candidate.label] = max_count.positive? ? counts.fetch(candidate.label, 0) / max_count : 0.0 end end |