Class: KQueue::Watcher::ReadWrite

Inherits:
KQueue::Watcher show all
Defined in:
lib/rb-kqueue/watcher/read_write.rb

Overview

The KQueue::Watcher subclass for events fired when a stream can be read from or written to (which of these is determined by #type). Read events are watched via Queue#watch_stream_for_read, and write events are watched via Queue#watch_stream_for_write.

Note that read and write events for sockets use the SocketReadWrite class.

Direct Known Subclasses

SocketReadWrite

Instance Attribute Summary collapse

Attributes inherited from KQueue::Watcher

#queue

Method Summary

Methods inherited from KQueue::Watcher

#add!, #delete!, #disable!, #enable!

Instance Attribute Details

#fdFixnum (readonly)

The file descriptor for the stream being watched.

Returns:

  • (Fixnum)

22
23
24
# File 'lib/rb-kqueue/watcher/read_write.rb', line 22

def fd
  @fd
end

#ioIO? (readonly)

The Ruby IO object from which the file descriptor was extracted. This is only set if an IO object was used to construct this watcher. Otherwise, it's nil.

Returns:

  • (IO, nil)

17
18
19
# File 'lib/rb-kqueue/watcher/read_write.rb', line 17

def io
  @io
end

#typeSymbol (readonly)

The type of watcher, :read or :write.

Returns:

  • (Symbol)

27
28
29
# File 'lib/rb-kqueue/watcher/read_write.rb', line 27

def type
  @type
end