Class: Observr::EventHandler::Unix
- Inherits:
-
Object
- Object
- Observr::EventHandler::Unix
- Includes:
- Base
- Defined in:
- lib/observr/event_handlers/unix.rb
Defined Under Namespace
Classes: SingleFileWatcher
Instance Method Summary collapse
-
#initialize ⇒ Unix
constructor
A new instance of Unix.
-
#listen(monitored_paths) ⇒ undefined
Enters listening loop.
-
#refresh(monitored_paths) ⇒ undefined
Rebuilds file bindings.
Methods included from Base
Constructor Details
#initialize ⇒ Unix
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.
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`
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 |