diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-08 10:42:03 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-08 10:42:03 -0800 |
commit | 1df3b65acccaee908b6a579640f5060094fad8c0 (patch) | |
tree | a4bedd51a590990537362d9074ec7086c73e3047 /activesupport/lib/active_support | |
parent | 9643243204fab063630380f42fcd4b8160044104 (diff) | |
download | rails-1df3b65acccaee908b6a579640f5060094fad8c0.tar.gz rails-1df3b65acccaee908b6a579640f5060094fad8c0.tar.bz2 rails-1df3b65acccaee908b6a579640f5060094fad8c0.zip |
use === so that regular expressions are not required
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/file_watcher.rb | 8 |
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 |