class Listen::Silencer
def _ignore?(path)
def _ignore?(path) ignore_patterns.any? { |pattern| path =~ pattern } end
def _init_ignores(ignores, overrides)
def _init_ignores(ignores, overrides) patterns = [] unless overrides patterns << DEFAULT_IGNORED_FILES patterns << DEFAULT_IGNORED_EXTENSIONS end patterns << ignores patterns << overrides patterns.compact.flatten end
def _only?(path)
def _only?(path) only_patterns.any? { |pattern| path =~ pattern } end
def configure(options)
def configure(options) @only_patterns = options[:only] ? Array(options[:only]) : nil @ignore_patterns = _init_ignores(options[:ignore], options[:ignore!]) end
def initialize(**options)
def initialize(**options) configure(options) end
def silenced?(relative_path, type)
def silenced?(relative_path, type) path = relative_path.to_s # in case it is a Pathname _ignore?(path) || (only_patterns && type == :file && !_only?(path)) end