class SimpleCov::Filter
end
end
false
def matches?(source_file)
class StupidFilter < SimpleCov::Filter
# A sample class that rejects all source files.
and overwrite the matches?(source_file) instance method
Base filter class. Inherit from this to create custom filters,
def self.build_filter(filter_argument)
def self.build_filter(filter_argument) return filter_argument if filter_argument.is_a?(SimpleCov::Filter) class_for_argument(filter_argument).new(filter_argument) end
def self.class_for_argument(filter_argument)
def self.class_for_argument(filter_argument) filter_classes_by_argument_type.find { |type, _| filter_argument.is_a?(type) }&.last || raise(SimpleCov::ConfigurationError, "You have provided an unrecognized filter type") end
def self.filter_classes_by_argument_type
def self.filter_classes_by_argument_type @filter_classes_by_argument_type ||= { String => SimpleCov::StringFilter, Regexp => SimpleCov::RegexFilter, Array => SimpleCov::ArrayFilter, Proc => SimpleCov::BlockFilter }.freeze end
def initialize(filter_argument)
def initialize(filter_argument) @filter_argument = filter_argument end
def matches?(_source_file)
def matches?(_source_file) raise NotImplementedError, "The base filter class is not intended for direct use" end