/usr/lib/ruby/vendor_ruby/active_support/file_watcher.rb is in ruby-activesupport-3.2 3.2.16-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 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
|