class Gazr::EventHandler::Unix
Public Class Methods
new()
click to toggle source
# File lib/gazr/event_handlers/unix.rb, line 76 def initialize SingleFileWatcher.handler = self @loop = Rev::Loop.default end
Public Instance Methods
listen(monitored_paths)
click to toggle source
Enters listening loop. Will block control flow until application is explicitly stopped/killed.
@return [undefined]
# File lib/gazr/event_handlers/unix.rb, line 86 def listen(monitored_paths) @monitored_paths = monitored_paths attach @loop.run end
refresh(monitored_paths)
click to toggle source
Rebuilds file bindings. Will detach all current bindings, and reattach the ‘monitored_paths`
@param [Array<Pathname>] monitored_paths
list of paths the application is currently monitoring.
@return [undefined]
# File lib/gazr/event_handlers/unix.rb, line 100 def refresh(monitored_paths) @monitored_paths = monitored_paths detach attach end
Private Instance Methods
attach()
click to toggle source
Binds all ‘monitored_paths` to the listening loop.
@return [undefined]
# File lib/gazr/event_handlers/unix.rb, line 112 def attach @monitored_paths.each {|path| SingleFileWatcher.new(path.to_s).attach(@loop) } end
detach()
click to toggle source
Unbinds all paths currently attached to listening loop.
@return [undefined]
# File lib/gazr/event_handlers/unix.rb, line 120 def detach @loop.watchers.each {|watcher| watcher.detach } end