Class: Observr::EventHandler::Darwin

Inherits:
FSEvent
  • Object
show all
Includes:
Base
Defined in:
lib/observr/event_handlers/darwin.rb

Overview

FSEvents based event handler for Darwin/OSX

Uses ruby-fsevents (github.com/sandro/ruby-fsevent)

Instance Method Summary collapse

Methods included from Base

#notify

Constructor Details

#initializeDarwin

Returns a new instance of Darwin.



28
29
30
31
# File 'lib/observr/event_handlers/darwin.rb', line 28

def initialize
  super
  self.latency = 0.2
end

Instance Method Details

#listen(monitored_paths) ⇒ undefined

Enter listening loop. Will block control flow until application is explicitly stopped/killed.

Returns:

  • (undefined)


38
39
40
41
# File 'lib/observr/event_handlers/darwin.rb', line 38

def listen(monitored_paths)
  register_paths(monitored_paths)
  start
end

#refresh(monitored_paths) ⇒ undefined

Rebuild file bindings. Will detach all current bindings, and reattach the ‘monitored_paths`

Parameters:

  • monitored_paths (Array<Pathname>)

    list of paths the application is currently monitoring.

Returns:

  • (undefined)


51
52
53
54
# File 'lib/observr/event_handlers/darwin.rb', line 51

def refresh(monitored_paths)
  register_paths(monitored_paths)
  restart
end