Module: Wake::EventHandler::Base
Overview
Base functionality mixin meant to be included in specific event handlers.
Instance Method Summary collapse
-
#listen(monitored_paths) ⇒ Object
Begin watching given paths and enter listening loop.
-
#notify(path, event_type = nil) ⇒ Object
Notify that a file was modified.
-
#refresh(monitored_paths) ⇒ Object
Called by the controller when the list of paths monitored by wantchr has changed.
Instance Method Details
#listen(monitored_paths) ⇒ Object
Begin watching given paths and enter listening loop. Called by the controller.
Abstract method
Parameters
- monitored_paths<Array(Pathname)>
-
list of paths the application is currently monitoring.
31 32 33 |
# File 'lib/wake/event_handlers/base.rb', line 31 def listen(monitored_paths) raise AbstractMethod end |
#notify(path, event_type = nil) ⇒ Object
Notify that a file was modified.
Parameters
- path<Pathname, String>
-
full path or path relative to current working directory
- event_type<Symbol>
-
event type.
– #changed and #notify_observers are Observable methods
19 20 21 22 |
# File 'lib/wake/event_handlers/base.rb', line 19 def notify(path, event_type = nil) changed(true) notify_observers(path, event_type) end |
#refresh(monitored_paths) ⇒ Object
Called by the controller when the list of paths monitored by wantchr has changed. It should refresh the list of paths being watched.
Abstract method
Parameters
- monitored_paths<Array(Pathname)>
-
list of paths the application is currently monitoring.
43 44 45 |
# File 'lib/wake/event_handlers/base.rb', line 43 def refresh(monitored_paths) raise AbstractMethod end |