Class: DevSuite::Utils::PathMatcher::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/dev_suite/utils/path_matcher/matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(includes: [], excludes: []) ⇒ Matcher

Returns a new instance of Matcher.



7
8
9
10
# File 'lib/dev_suite/utils/path_matcher/matcher.rb', line 7

def initialize(includes: [], excludes: [])
  @include_patterns = includes.map { |pattern| Pattern.new(pattern) }
  @exclude_patterns = excludes.map { |pattern| Pattern.new(pattern) }
end

Instance Method Details

#match?(path) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/dev_suite/utils/path_matcher/matcher.rb', line 12

def match?(path)
  return false if excluded?(path)
  return true if included?(path)

  false
end