Class Guard::Watcher
In: lib/guard/watcher.rb
Parent: Object

The watcher defines a RegExp that will be matched against file system modifications. When a watcher matches a change, an optional action block is executed to enable processing the file system change result.

Methods

Attributes

action  [RW] 
pattern  [RW] 

Public Class methods

Finds the files that matches a Guard.

@param [Guard::Guard] guard the Guard plugin which watchers are used @param [Array<String>] files the changed files @return [Array<Object>] the matched watcher response

Test if a file would be matched by any of the Guard plugin watchers.

@param [Array<Guard::Guard>] guards the Guard plugins to use the watchers from @param [Array<String>] files the files to test @return [Boolean] Whether a file matches

Test if any of the files is the Guardfile.

@param [Array<String>] files the files to test @return [Boolean] whether one of these files is the Guardfile

Initialize a file watcher.

@param [String, Regexp] pattern the pattern to be watched by the Guard plugin @param [Block] action the action to execute before passing the result to the Guard plugin

Public Instance methods

Executes a watcher action.

@param [String, MatchData] matches the matched path or the match from the Regex @return [String] the final paths

Test the watchers pattern against a file.

@param [String] file the file to test @return [Array<String>] an array of matches (or containing a single path if the pattern is a string)

@deprecated Use .match instead

[Validate]