Sha256: ac4db60d1e21fdd5fb5f16bf6021c746ee1e4f732827ee1cb14dd686413f40ac
Contents?: true
Size: 1.53 KB
Versions: 10
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2018-2022, by Samuel Williams. module Covered class Base def enable end def disable end def flush end def accept?(path) true end def mark(path, lineno, value) end def add(source) end def each end def relative_path(path) path end def expand_path(path) path end end class Wrapper < Base def initialize(output = Base.new) @output = output end attr :output def enable @output.enable end def disable @output.disable end def flush @output.flush end def accept?(path) @output.accept?(path) end def mark(path, lineno, value) @output.mark(path, lineno, value) end def add(source) @output.add(source) end # @yield [Coverage] the path to the file, and the execution counts. def each(&block) @output.each(&block) end def relative_path(path) @output.relative_path(path) end def expand_path(path) @output.expand_path(path) end def to_h @output.to_enum(:each).collect{|coverage| [coverage.path, coverage]}.to_h end end class Filter < Wrapper def mark(path, lineno, value) @output.mark(path, lineno, value) if accept?(path) end # @yield [Coverage] the path to the file, and the execution counts. def each(&block) @output.each do |coverage| yield coverage if accept?(coverage.path) end end def accept?(path) match?(path) and super end def match?(path) true end end end
Version data entries
10 entries across 10 versions & 1 rubygems