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
- DEFAULT_LATENCY =
The default delay between checking for changes.
0.1
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #_configure ⇒ Object private
- #_latency ⇒ Object private
- #_run ⇒ Object private
Methods inherited from Base
#_directories, #_log, #_notify_change, #initialize, local_fs?, #start, usable?
Constructor Details
This class inherits a constructor from Listen::Adapter::Base
Instance Method Details
#_configure ⇒ Object (private)
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/listen/adapter/darwin.rb', line 13 def _configure require 'rb-fsevent' @worker = FSEvent.new @worker.watch(_directories.map(&:to_s), latency: _latency) do |changes| changes.each do |path| new_path = Pathname.new(path.sub(/\/$/, '')) _log :debug, "fsevent: #{new_path}" _notify_change(:dir, new_path) end end end |
#_latency ⇒ Object (private)
29 30 31 |
# File 'lib/listen/adapter/darwin.rb', line 29 def _latency listener.[:latency] || DEFAULT_LATENCY end |
#_run ⇒ Object (private)
25 26 27 |
# File 'lib/listen/adapter/darwin.rb', line 25 def _run @worker.run end |