Class: FChange::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/rb-fchange/event.rb

Overview

An event caused by a change on the filesystem. Each Watcher can fire many events, which are passed to that watcher’s callback.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(watcher) ⇒ Event

Creates an event from a string of binary data. Differs from Event.consume in that it doesn’t modify the string.

Parameters:



16
17
18
# File 'lib/rb-fchange/event.rb', line 16

def initialize(watcher)
  @watcher = watcher
end

Instance Attribute Details

#watcherWatcher (readonly)

The Watcher that fired this event.

Returns:



9
10
11
# File 'lib/rb-fchange/event.rb', line 9

def watcher
  @watcher
end

Instance Method Details

#callback!Object

Calls the callback of the watcher that fired this event, passing in the event itself.



24
25
26
# File 'lib/rb-fchange/event.rb', line 24

def callback!
  @watcher.callback!(self)
end