Module: Polyrun::Coverage::Filter
- Defined in:
- lib/polyrun/coverage/filter.rb
Overview
Drop paths from a coverage blob when the path matches any reject pattern (substring). Mirrors SimpleCov add_filter style paths (e.g. “/lib/generators/”).
Class Method Summary collapse
Class Method Details
.reject_matching_paths(blob, patterns) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/polyrun/coverage/filter.rb', line 8 def reject_matching_paths(blob, patterns) return blob unless blob.is_a?(Hash) pats = Array(patterns).map(&:to_s).reject(&:empty?) return blob if pats.empty? blob.each_with_object({}) do |(path, entry), acc| next if pats.any? { |p| path.to_s.include?(p) } acc[path] = entry end end |