Class: CZTop::Poller::Event
- Inherits:
-
Object
- Object
- CZTop::Poller::Event
- Defined in:
- lib/cztop/poller.rb
Overview
Represents an event returned by #wait. This is useful to find out whether the associated socket is now readable or writable, in case you’re interested in both. For a simpler variant, check out #simple_wait.
Instance Method Summary collapse
-
#initialize(poller, event_ptr) ⇒ Event
constructor
A new instance of Event.
-
#readable? ⇒ Boolean
Whether it’s readable.
-
#socket ⇒ Socket, Actor
The associated socket.
-
#writable? ⇒ Boolean
Whether it’s writable.
Constructor Details
#initialize(poller, event_ptr) ⇒ Event
Returns a new instance of Event.
219 220 221 222 |
# File 'lib/cztop/poller.rb', line 219 def initialize(poller, event_ptr) @poller = poller @poller_event = ZMQ::PollerEvent.new(event_ptr) end |
Instance Method Details
#readable? ⇒ Boolean
Returns whether it’s readable.
232 233 234 |
# File 'lib/cztop/poller.rb', line 232 def readable? @poller_event.readable? end |
#socket ⇒ Socket, Actor
Returns the associated socket.
226 227 228 |
# File 'lib/cztop/poller.rb', line 226 def socket @socket ||= @poller.socket_for_ptr(@poller_event[:socket]) end |
#writable? ⇒ Boolean
Returns whether it’s writable.
238 239 240 |
# File 'lib/cztop/poller.rb', line 238 def writable? @poller_event.writable? end |