aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/file_watcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/file_watcher.rb')
-rw-r--r--activesupport/lib/active_support/file_watcher.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/file_watcher.rb b/activesupport/lib/active_support/file_watcher.rb
index 046a5a0309..81b4b117c1 100644
--- a/activesupport/lib/active_support/file_watcher.rb
+++ b/activesupport/lib/active_support/file_watcher.rb
@@ -15,21 +15,17 @@ module ActiveSupport
@regex_matchers = {}
end
- def watch(path, &block)
- return watch_regex(path, &block) if path.is_a?(Regexp)
- raise "Paths must be regular expressions. #{path.inspect} is a #{path.class}"
- end
-
def watch_regex(regex, &block)
@regex_matchers[regex] = block
end
+ alias :watch :watch_regex
def trigger(files)
trigger_files = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = [] } }
files.each do |file, state|
@regex_matchers.each do |regex, block|
- trigger_files[block][state] << file if file =~ regex
+ trigger_files[block][state] << file if regex === file
end
end