Class | Listen::DirectoryRecord |
In: |
lib/listen/directory_record.rb
|
Parent: | Object |
The directory record stores information about a directory and keeps track of changes to the structure of its childs.
DEFAULT_IGNORED_DIRECTORIES | = | %w[.rbx .bundle .git .svn log tmp vendor] | The default list of directories that get ignored by the listener. | |
DEFAULT_IGNORED_EXTENSIONS | = | %w[.DS_Store] | The default list of files that get ignored by the listener. | |
HIGH_PRECISION_SUPPORTED | = | File.mtime(__FILE__).to_f.to_s[-2..-1] != '.0' | ||
HIGH_PRECISION_SUPPORTED | = | false | ||
MetaData | = | Struct.new(:type, :mtime) | Data structure used to save meta data about a path |
directory | [R] | |
paths | [R] | |
sha1_checksums | [R] |
Creates the ignoring patterns from the default ignored directories and extensions. It memoizes the generated patterns to avoid unnecessary computation.
Detects changes in the passed directories, updates the record with the new changes and returns the changes.
@param [Array] directories the list of directories to scan for changes @param [Hash] options @option options [Boolean] recursive scan all sub-directories recursively @option options [Boolean] relative_paths whether or not to use relative paths for changes
@return [Hash<Array>] the changes
Adds filtering patterns to the record.
@example Filter some files
filter /\.txt$/, /.*\.zip/
@param [Regexp] regexps a list of patterns for filtering files
Replaces filtering patterns in the record.
@example Filter only these files
filter! /\.txt$/, /.*\.zip/
@param [Regexp] regexps a list of patterns for filtering files
Returns whether a path should be filtered or not.
@param [String] path the path to test
@return [Boolean]
Returns the filtering patterns in the record to know which paths should be stored.
@return [Array<Regexp>] the filtering patterns
Adds ignoring patterns to the record.
@example Ignore some paths
ignore %r{^ignored/path/}, /man/
@param [Regexp] regexps a list of patterns for ignoring paths
Replaces ignoring patterns in the record.
@example Ignore only these paths
ignore! %r{^ignored/path/}, /man/
@param [Regexp] regexps a list of patterns for ignoring paths
Returns whether a path should be ignored or not.
@param [String] path the path to test
@return [Boolean]
Returns the ignoring patterns in the record to know which paths should be ignored.
@return [Array<Regexp>] the ignoring patterns