Class: Wake::EventHandler::Rev

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/wake/event_handlers/rev.rb

Defined Under Namespace

Classes: SingleFileWatcher

Instance Method Summary collapse

Methods included from Base

#notify

Constructor Details

#initializeRev

Returns a new instance of Rev.



66
67
68
69
# File 'lib/wake/event_handlers/rev.rb', line 66

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

Instance Method Details

#listen(monitored_paths) ⇒ Object

Enters listening loop.

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



75
76
77
78
79
# File 'lib/wake/event_handlers/rev.rb', line 75

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

#refresh(monitored_paths) ⇒ Object

Rebuilds file bindings.

will detach all current bindings, and reattach the monitored_paths



85
86
87
88
89
# File 'lib/wake/event_handlers/rev.rb', line 85

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