Class: SimpleCov::Filter
- Inherits:
-
Object
- Object
- SimpleCov::Filter
- Defined in:
- lib/simplecov/filter.rb
Overview
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
Direct Known Subclasses
Instance Attribute Summary collapse
-
#filter_argument ⇒ Object
readonly
Returns the value of attribute filter_argument.
Instance Method Summary collapse
-
#initialize(filter_argument) ⇒ Filter
constructor
A new instance of Filter.
- #matches?(_) ⇒ Boolean
- #passes?(source_file) ⇒ Boolean
Constructor Details
#initialize(filter_argument) ⇒ Filter
Returns a new instance of Filter.
15 16 17 |
# File 'lib/simplecov/filter.rb', line 15 def initialize(filter_argument) @filter_argument = filter_argument end |
Instance Attribute Details
#filter_argument ⇒ Object (readonly)
Returns the value of attribute filter_argument.
14 15 16 |
# File 'lib/simplecov/filter.rb', line 14 def filter_argument @filter_argument end |
Instance Method Details
#matches?(_) ⇒ Boolean
19 20 21 |
# File 'lib/simplecov/filter.rb', line 19 def matches?(_) raise "The base filter class is not intended for direct use" end |
#passes?(source_file) ⇒ Boolean
23 24 25 26 |
# File 'lib/simplecov/filter.rb', line 23 def passes?(source_file) warn "#{Kernel.caller.first}: [DEPRECATION] #passes? is deprecated. Use #matches? instead." matches?(source_file) end |