Sha256: e3bdd841627d4541d625a42fcc5497b1b76158c561d9e545f64b7f310931f20c
Contents?: true
Size: 744 Bytes
Versions: 346
Compression:
Stored size: 744 Bytes
Contents
module ActiveSupport class FileWatcher class Backend def initialize(path, watcher) @watcher = watcher @path = path end def trigger(files) @watcher.trigger(files) end end def initialize @regex_matchers = {} end def watch(pattern, &block) @regex_matchers[pattern] = block end 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 end end
Version data entries
346 entries across 302 versions & 28 rubygems