Class: Wake::EventHandler::Rev::SingleFileWatcher
- Inherits:
-
Rev::StatWatcher
- Object
- Rev::StatWatcher
- Wake::EventHandler::Rev::SingleFileWatcher
- Defined in:
- lib/wake/event_handlers/rev.rb
Overview
Used by Rev. Wraps a monitored path, and Rev::Loop will call its callback on file events.
Class Attribute Summary collapse
-
.handler ⇒ Object
Stores a reference back to handler so we can call its #nofity method with file event info.
Instance Method Summary collapse
-
#initialize(path) ⇒ SingleFileWatcher
constructor
A new instance of SingleFileWatcher.
-
#on_change ⇒ Object
Callback.
-
#pathname ⇒ Object
File’s path as a Pathname.
Constructor Details
#initialize(path) ⇒ SingleFileWatcher
Returns a new instance of SingleFileWatcher.
22 23 24 25 |
# File 'lib/wake/event_handlers/rev.rb', line 22 def initialize(path) super update_reference_times end |
Class Attribute Details
.handler ⇒ Object
Stores a reference back to handler so we can call its #nofity method with file event info
19 20 21 |
# File 'lib/wake/event_handlers/rev.rb', line 19 def handler @handler end |
Instance Method Details
#on_change ⇒ Object
Callback. Called on file change event Delegates to Controller#update, passing in path and event type
34 35 36 37 |
# File 'lib/wake/event_handlers/rev.rb', line 34 def on_change self.class.handler.notify(path, type) update_reference_times unless type == :deleted end |
#pathname ⇒ Object
File’s path as a Pathname
28 29 30 |
# File 'lib/wake/event_handlers/rev.rb', line 28 def pathname @pathname ||= Pathname(@path) end |