Class: CZTop::Poller::ZMQ::PollerEvent

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/cztop/poller/zmq.rb

Overview

This represents a zmq_poller_event_t as in:

typedef struct zmq_poller_event_t
{
    void *socket;
    int fd;
    void *user_data;
    short events;
} zmq_poller_event_t;

Instance Method Summary collapse

Instance Method Details

#readable?Boolean

Returns whether the socket is readable.

Returns:

  • (Boolean)

    whether the socket is readable



35
36
37
# File 'lib/cztop/poller/zmq.rb', line 35

def readable?
  (self[:events] & POLLIN).positive?
end

#writable?Boolean

Returns whether the socket is writable.

Returns:

  • (Boolean)

    whether the socket is writable



41
42
43
# File 'lib/cztop/poller/zmq.rb', line 41

def writable?
  (self[:events] & POLLOUT).positive?
end