Class: ZMQ::PollItem
- Inherits:
-
Object
- Object
- ZMQ::PollItem
- Extended by:
- Forwardable
- Defined in:
- lib/ffi-rzmq/poll_item.rb
Instance Attribute Summary collapse
-
#poll_item ⇒ Object
Returns the value of attribute poll_item.
-
#pollable ⇒ Object
Returns the value of attribute pollable.
Class Method Summary collapse
Instance Method Summary collapse
- #closed? ⇒ Boolean
- #events ⇒ Object
- #events=(arg) ⇒ Object
- #fd ⇒ Object
- #fd=(arg) ⇒ Object
-
#initialize(zmq_poll_item = nil) ⇒ PollItem
constructor
A new instance of PollItem.
- #socket ⇒ Object
- #socket=(arg) ⇒ Object
Constructor Details
#initialize(zmq_poll_item = nil) ⇒ PollItem
Returns a new instance of PollItem.
10 11 12 |
# File 'lib/ffi-rzmq/poll_item.rb', line 10 def initialize(zmq_poll_item = nil) @poll_item = zmq_poll_item || LibZMQ::PollItem.new end |
Instance Attribute Details
#poll_item ⇒ Object
Returns the value of attribute poll_item.
8 9 10 |
# File 'lib/ffi-rzmq/poll_item.rb', line 8 def poll_item @poll_item end |
#pollable ⇒ Object
Returns the value of attribute pollable.
8 9 10 |
# File 'lib/ffi-rzmq/poll_item.rb', line 8 def pollable @pollable end |
Class Method Details
.from_pointer(pointer) ⇒ Object
14 15 16 |
# File 'lib/ffi-rzmq/poll_item.rb', line 14 def self.from_pointer(pointer) self.new(LibZMQ::PollItem.new(pointer)) end |
.from_pollable(pollable) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ffi-rzmq/poll_item.rb', line 18 def self.from_pollable(pollable) item = self.new item.pollable = pollable case when pollable.respond_to?(:socket) item.socket = pollable.socket when pollable.respond_to?(:posix_fileno) item.fd = pollable.posix_fileno when pollable.respond_to?(:io) item.fd = pollable.io.posix_fileno end item end |
Instance Method Details
#closed? ⇒ Boolean
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ffi-rzmq/poll_item.rb', line 32 def closed? case when pollable.respond_to?(:closed?) pollable.closed? when pollable.respond_to?(:socket) pollable.socket.nil? when pollable.respond_to?(:io) pollable.io.closed? end end |
#events ⇒ Object
53 |
# File 'lib/ffi-rzmq/poll_item.rb', line 53 def events; @poll_item[:events]; end |
#events=(arg) ⇒ Object
51 |
# File 'lib/ffi-rzmq/poll_item.rb', line 51 def events=(arg); @poll_item[:events] = arg; end |
#fd ⇒ Object
49 |
# File 'lib/ffi-rzmq/poll_item.rb', line 49 def fd; @poll_item[:fd]; end |
#fd=(arg) ⇒ Object
47 |
# File 'lib/ffi-rzmq/poll_item.rb', line 47 def fd=(arg); @poll_item[:fd] = arg; end |
#socket ⇒ Object
45 |
# File 'lib/ffi-rzmq/poll_item.rb', line 45 def socket; @poll_item[:socket]; end |
#socket=(arg) ⇒ Object
43 |
# File 'lib/ffi-rzmq/poll_item.rb', line 43 def socket=(arg); @poll_item[:socket] = arg; end |