Class: Listen::Silencer

Inherits:
Object
  • Object
show all
Defined in:
lib/middleman-core/sources/source_watcher.rb

Instance Method Summary collapse

Instance Method Details

#silenced?(relative_path, _type) ⇒ Boolean

TODO: switch type and path places - and verify

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/middleman-core/sources/source_watcher.rb', line 11

def silenced?(relative_path, _type)
  path = relative_path.to_s

  # if only_patterns && type == :file
  #   return true unless only_patterns.any? { |pattern| path =~ pattern }
  # end

  return !only_patterns.any? { |pattern| path =~ pattern } if only_patterns

  ignore_patterns.any? { |pattern| path =~ pattern }
end