Class: Mbeditor::ExclusionMatcher

Inherits:
Object
  • Object
show all
Defined in:
app/services/mbeditor/exclusion_matcher.rb

Instance Method Summary collapse

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

Returns:

  • (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