Class: KQueue::Event

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

Overview

An event produced by kqueue. Each Watcher can fire many events, which are passed to that Watcher's callback.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataFixnum (readonly)

Some integer data, the interpretation of which is specific to each individual Watcher. For specifics, see the individual Watcher subclasses.

data is not meaningful for all events. For example, file-change notifications do not set data.

Returns:

  • (Fixnum)


14
15
16
# File 'lib/rb-kqueue/event.rb', line 14

def data
  @data
end

Instance Method Details

#eof?Boolean

Returns whether the end-of-file flag has been set for this event. The interpretation of this is specific to each individual Watcher.

eof? is not meaningful for all events. For example, file-change notifications don't set eof?.

Returns:

  • (Boolean)


52
53
54
# File 'lib/rb-kqueue/event.rb', line 52

def eof?
  @flags.include?(:eof)
end

#flagsArray<Symbol>

An array of flags, the interpretation of which is specific to each individual Watcher.

If the Watcher watches for different sorts of events, this is usually the specific events that actually occurred. For example, for file-change notifications this could be [:delete].

flags is not meaningful for all events. For example, readability notifications do not set flags.

Returns:

  • (Array<Symbol>)


41
42
43
# File 'lib/rb-kqueue/event.rb', line 41

def flags
  @fflags ||= Native::Flags.from_mask("NOTE_#{filter.to_s.upcase}", @native[:fflags])
end

#watcherWatcher

The Watcher that produced this event.

Returns:



26
27
28
# File 'lib/rb-kqueue/event.rb', line 26

def watcher
  @watcher ||= @queue.watchers[[filter, @native[:ident]]]
end