Sha256: ad4fea7052d14d81e80c6288a2118d04afe99a8e949b2a111a90837759d59452
Contents?: true
Size: 992 Bytes
Versions: 2
Compression:
Stored size: 992 Bytes
Contents
module FSSM::Backends class RBFSEvent def initialize @handlers = [] end def add_handler(handler, preload=true) @handlers << handler handler.refresh(nil, true) if preload end def run begin @fsevent = FSEvent.new @fsevent.watch(temporary_multipath_hack) do |paths| paths.each do |path| temporary_multipath_handler(path) end end @fsevent.run rescue Interrupt @fsevent.stop end end def temporary_multipath_handler(path) @handlers.each do |handler| handler_path = File.join(handler.path.to_s, "") if handler_path.start_with?(path) handler.refresh(path) break end end end def temporary_multipath_hack @handlers = @handlers.sort {|x,y| y.path.to_pathname.segments.length <=> x.path.to_pathname.segments.length} return @handlers.map {|handler| handler.path.to_s} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fssm-0.2.6.1 | lib/fssm/backends/rbfsevent.rb |
fssm-0.2.6 | lib/fssm/backends/rbfsevent.rb |