aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/file_update_checker.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-06-12 10:36:13 +0200
committerJosé Valim <jose.valim@gmail.com>2012-06-12 10:36:13 +0200
commit5ea2b11ad7fb1e0e0580edd9d8e0e688cfffa3f2 (patch)
treeedd95f4a86c01cbb22817064072c050938a28f0c /activesupport/lib/active_support/file_update_checker.rb
parente6ea3fec305db2872827aedd95a77d343079b8f5 (diff)
downloadrails-5ea2b11ad7fb1e0e0580edd9d8e0e688cfffa3f2.tar.gz
rails-5ea2b11ad7fb1e0e0580edd9d8e0e688cfffa3f2.tar.bz2
rails-5ea2b11ad7fb1e0e0580edd9d8e0e688cfffa3f2.zip
Stop relying on mutable structures in the FileUpdateChecker
Diffstat (limited to 'activesupport/lib/active_support/file_update_checker.rb')
-rw-r--r--activesupport/lib/active_support/file_update_checker.rb19
1 files changed, 4 insertions, 15 deletions
diff --git a/activesupport/lib/active_support/file_update_checker.rb b/activesupport/lib/active_support/file_update_checker.rb
index 8860636168..48c39d9370 100644
--- a/activesupport/lib/active_support/file_update_checker.rb
+++ b/activesupport/lib/active_support/file_update_checker.rb
@@ -35,22 +35,11 @@ module ActiveSupport
# 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, updated, and 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 supported.
- #
- # Notice that other objects that implement the 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.
+ # This method must also receive a block that will be called once a path
+ # changes. The array of files and list of directories cannot be changed
+ # after FileUpdateChecker has been initialized.
def initialize(files, dirs={}, &block)
- @files = files
+ @files = files.freeze
@glob = compile_glob(dirs)
@block = block