class SimpleCov::Filter
Base filter class. Inherit from this to create custom filters, and overwrite the passes?(source_file) instance method
# A sample class that rejects all source files. class StupidFilter < SimpleCov::Filter
def passes?(source_file) false end
end
Attributes
filter_argument[R]
Public Class Methods
build_filter(filter_argument)
click to toggle source
# File lib/simplecov/filter.rb, line 30 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
class_for_argument(filter_argument)
click to toggle source
# File lib/simplecov/filter.rb, line 36 def self.class_for_argument(filter_argument) case filter_argument when String SimpleCov::StringFilter when Regexp SimpleCov::RegexFilter when Array SimpleCov::ArrayFilter when Proc SimpleCov::BlockFilter else raise ArgumentError, "You have provided an unrecognized filter type" end end
new(filter_argument)
click to toggle source
# File lib/simplecov/filter.rb, line 17 def initialize(filter_argument) @filter_argument = filter_argument end
Public Instance Methods
matches?(_source_file)
click to toggle source
# File lib/simplecov/filter.rb, line 21 def matches?(_source_file) raise "The base filter class is not intended for direct use" end
passes?(source_file)
click to toggle source
# File lib/simplecov/filter.rb, line 25 def passes?(source_file) warn "#{Kernel.caller.first}: [DEPRECATION] #passes? is deprecated. Use #matches? instead." matches?(source_file) end