Flowdock
method

new

Importance_2
v3.2.3 - Show latest stable - 0 notes - Class: ActiveSupport::FileUpdateChecker
new(files, dirs={}, &block) public

It accepts two parameters on initialization. The first is an array of files and the second is an optional hash of directories. The hash must have directories as keys and the value is an array of extensions to be watched under that directory.

This method must also receive a block that will be called once a path changes.

Implementation details

This particular implementation checks for added and updated files, but not removed files. Directories lookup are compiled to a glob for performance. Therefore, while someone can add new files to the files array after initialization (and parts of Rails do depend on this feature), adding new directories after initialization is not allowed.

Notice that other objects that implements FileUpdateChecker API may not even allow new files to be added after initialization. If this is the case, we recommend freezing the files after initialization to avoid changes that won’t make effect.

Show source
Register or log in to add new notes.