Class: Observr::EventHandler::Unix

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

Defined Under Namespace

Classes: SingleFileWatcher

Instance Method Summary collapse

Methods included from Base

#notify

Constructor Details

#initializeUnix

Returns a new instance of Unix.



76
77
78
79
# File 'lib/observr/event_handlers/unix.rb', line 76

def initialize
  SingleFileWatcher.handler = self
  @loop = Rev::Loop.default
end

Instance Method Details

#listen(monitored_paths) ⇒ undefined

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

Returns:

  • (undefined)


86
87
88
89
90
# File 'lib/observr/event_handlers/unix.rb', line 86

def listen(monitored_paths)
  @monitored_paths = monitored_paths
  attach
  @loop.run
end

#refresh(monitored_paths) ⇒ undefined

Rebuilds 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)


100
101
102
103
104
# File 'lib/observr/event_handlers/unix.rb', line 100

def refresh(monitored_paths)
  @monitored_paths = monitored_paths
  detach
  attach
end