class Kicker::FSEvents

Public Class Methods

start_watching(paths, options={}) { |map { |directory| fs_event}| ... } click to toggle source
# File lib/kicker/fsevents.rb, line 25
def self.start_watching(paths, options={}, &block)
  listener = Listen.to(*(paths.dup << options))
  listener.change do |modified, added, removed|
    files = modified + added + removed
    directories = files.map { |file| File.dirname(file) }.uniq
    yield directories.map { |directory| Kicker::FSEvents::FSEvent.new(directory) }
  end
  listener.start
  listener
end