class ActiveSupport::FileWatcher

def initialize

def initialize
  @regex_matchers = {}
end

def trigger(files)

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 |pattern, block|
      trigger_files[block][state] << file if pattern === file
    end
  end
  trigger_files.each do |block, payload|
    block.call payload
  end
end

def watch(pattern, &block)

def watch(pattern, &block)
  @regex_matchers[pattern] = block
end