Class: LibZMQ::PollItem

Inherits:
FFI::Struct
  • Object
show all
Includes:
PollItemLayout
Defined in:
lib/ffi-rzmq-core/structures.rb

Overview

PollItem class includes the PollItemLayout module so that we can use the basic FFI accessors to get at the structure’s fields. We also want to provide some higher-level Ruby accessors for convenience.

Instance Method Summary collapse

Methods included from PollItemLayout

included

Instance Method Details

#fdObject



83
84
85
# File 'lib/ffi-rzmq-core/structures.rb', line 83

def fd
  self[:fd]
end

#inspectObject



95
96
97
# File 'lib/ffi-rzmq-core/structures.rb', line 95

def inspect
  "socket [#{socket}], fd [#{fd}], events [#{self[:events]}], revents [#{self[:revents]}]"
end

#readable?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/ffi-rzmq-core/structures.rb', line 87

def readable?
  (self[:revents] & ZMQ::POLLIN) > 0
end

#socketObject



79
80
81
# File 'lib/ffi-rzmq-core/structures.rb', line 79

def socket
  self[:socket]
end

#writable?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/ffi-rzmq-core/structures.rb', line 91

def writable?
  (self[:revents] & ZMQ::POLLOUT) > 0
end