use === so that regular expressions are not required

This commit is contained in:
Aaron Patterson 2011-02-08 10:48:01 -08:00
parent 1df3b65acc
commit 51414a0893
1 changed files with 4 additions and 5 deletions

View File

@ -15,17 +15,16 @@ module ActiveSupport
@regex_matchers = {}
end
def watch_regex(regex, &block)
@regex_matchers[regex] = block
def watch(pattern, &block)
@regex_matchers[pattern] = 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 regex === file
@regex_matchers.each do |pattern, block|
trigger_files[block][state] << file if pattern === file
end
end