Class: Listen::Adapter::Darwin
- Defined in:
- lib/listen/adapter/darwin.rb
Overview
Adapter implementation for Mac OS X FSEvents
.
Constant Summary collapse
- OS_REGEXP =
/darwin(1.+)?$/i
- DEFAULTS =
The default delay between checking for changes.
{ latency: 0.1 }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #_configure(dir, &callback) ⇒ Object private
- #_process_event(dir, event) ⇒ Object private
- #_run ⇒ Object private
Methods inherited from Base
_log, #_log, #_queue_change, #configure, #initialize, local_fs?, #start, usable?
Constructor Details
This class inherits a constructor from Listen::Adapter::Base
Instance Method Details
#_configure(dir, &callback) ⇒ Object (private)
13 14 15 16 17 18 |
# File 'lib/listen/adapter/darwin.rb', line 13 def _configure(dir, &callback) require 'rb-fsevent' @worker ||= FSEvent.new opts = { latency: .latency } @worker.watch(dir.to_s, opts, &callback) end |
#_process_event(dir, event) ⇒ Object (private)
24 25 26 27 28 29 30 31 32 |
# File 'lib/listen/adapter/darwin.rb', line 24 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 ⇒ Object (private)
20 21 22 |
# File 'lib/listen/adapter/darwin.rb', line 20 def _run @worker.run end |