Class: SimpleCov::ArrayFilter
Overview
Filter that matches when any of its component filters (built from the array’s elements) match the source file.
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary collapse
-
#initialize(filter_argument) ⇒ ArrayFilter
constructor
A new instance of ArrayFilter.
-
#matches?(source_files_list) ⇒ Boolean
Returns true if any of the filters in the array match the given source file.
Methods inherited from Filter
build_filter, class_for_argument
Constructor Details
#initialize(filter_argument) ⇒ ArrayFilter
Returns a new instance of ArrayFilter.
123 124 125 126 127 128 129 |
# File 'lib/simplecov/filter.rb', line 123 def initialize(filter_argument) filter_objects = filter_argument.map do |arg| Filter.build_filter(arg) end super(filter_objects) end |
Instance Method Details
#matches?(source_files_list) ⇒ Boolean
Returns true if any of the filters in the array match the given source file. Configure this Filter like StringFilter.new([‘some/path’, /^some_regex/, Proc.new {|src_file| … }])
133 134 135 136 137 |
# File 'lib/simplecov/filter.rb', line 133 def matches?(source_files_list) filter_argument.any? do |arg| arg.matches?(source_files_list) end end |