Sha256: dc15c38357ce40d6cc9881c1dd0af938d257e27fbe7731ca7ab4ff72433e624a
Contents?: true
Size: 920 Bytes
Versions: 15
Compression:
Stored size: 920 Bytes
Contents
module Listen module Adapter # Adapter implementation for Mac OS X `FSEvents`. # class Darwin < Base def self.usable? RbConfig::CONFIG['target_os'] =~ /darwin(1.+)?$/i end def initialize(listener) require 'rb-fsevent' super end def start worker = _init_worker Thread.new { worker.run } end private # Initializes a FSEvent worker and adds a watcher for # each directory listened. # def _init_worker FSEvent.new.tap do |worker| worker.watch(_directories_path, latency: _latency) do |changes| _changes_path(changes).each { |path| _notify_change(path, type: 'Dir') } end end end def _changes_path(changes) changes.map do |path| path.sub!(/\/$/, '') Pathname.new(path) end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems