class Listen::Adapter::Darwin

Adapter implementation for Mac OS X `FSEvents`.

Constants

DEFAULTS

The default delay between checking for changes.

OS_REGEXP

Private Instance Methods

_configure(dir, &callback) click to toggle source
# File lib/listen/adapter/darwin.rb, line 13
def _configure(dir, &callback)
  require 'rb-fsevent'
  opts = { latency: options.latency }

  @workers ||= Queue.new
  @workers << FSEvent.new.tap do |worker|
    worker.watch(dir.to_s, opts, &callback)
  end
end
_process_event(dir, event) click to toggle source
# File lib/listen/adapter/darwin.rb, line 27
def _process_event(dir, event)
  event.each do |path|
    new_path = Pathname.new(path.sub(/\/$/, ''))
    _log :debug, "fsevent: #{new_path}"
    # TODO: does this preserve symlinks?
    rel_path = new_path.relative_path_from(dir).to_s
    _queue_change(:dir, dir, rel_path, recursive: true)
  end
end
_run() click to toggle source
# File lib/listen/adapter/darwin.rb, line 23
def _run
  @workers.pop.run while !@workers.empty?
end