Class: Undercover::FilterSet
- Inherits:
-
Object
- Object
- Undercover::FilterSet
- Defined in:
- lib/undercover/filter_set.rb
Instance Attribute Summary collapse
-
#allow_filters ⇒ Object
readonly
Returns the value of attribute allow_filters.
-
#reject_filters ⇒ Object
readonly
Returns the value of attribute reject_filters.
Instance Method Summary collapse
- #include?(filepath) ⇒ Boolean
-
#initialize(allow_filters, reject_filters) ⇒ FilterSet
constructor
A new instance of FilterSet.
Constructor Details
#initialize(allow_filters, reject_filters) ⇒ FilterSet
Returns a new instance of FilterSet.
7 8 9 10 |
# File 'lib/undercover/filter_set.rb', line 7 def initialize(allow_filters, reject_filters) @allow_filters = allow_filters || [] @reject_filters = reject_filters || [] end |
Instance Attribute Details
#allow_filters ⇒ Object (readonly)
Returns the value of attribute allow_filters.
5 6 7 |
# File 'lib/undercover/filter_set.rb', line 5 def allow_filters @allow_filters end |
#reject_filters ⇒ Object (readonly)
Returns the value of attribute reject_filters.
5 6 7 |
# File 'lib/undercover/filter_set.rb', line 5 def reject_filters @reject_filters end |
Instance Method Details
#include?(filepath) ⇒ Boolean
12 13 14 15 |
# File 'lib/undercover/filter_set.rb', line 12 def include?(filepath) fnmatch = proc { |glob| File.fnmatch(glob, filepath) } allow_filters.any?(fnmatch) && reject_filters.none?(fnmatch) end |