Class: Mbeditor::ExclusionMatcher
- Inherits:
-
Object
- Object
- Mbeditor::ExclusionMatcher
- Defined in:
- app/services/mbeditor/exclusion_matcher.rb
Instance Method Summary collapse
- #excluded?(relative_path) ⇒ Boolean
-
#initialize(patterns) ⇒ ExclusionMatcher
constructor
A new instance of ExclusionMatcher.
Constructor Details
#initialize(patterns) ⇒ ExclusionMatcher
Returns a new instance of ExclusionMatcher.
5 6 7 |
# File 'app/services/mbeditor/exclusion_matcher.rb', line 5 def initialize(patterns) @patterns = patterns.map(&:to_s).reject(&:empty?) end |
Instance Method Details
#excluded?(relative_path) ⇒ Boolean
9 10 11 |
# File 'app/services/mbeditor/exclusion_matcher.rb', line 9 def excluded?(relative_path) @patterns.any? { |pattern| matches?(pattern, relative_path) } end |