Sha256: 016256d4d3d5eb4ed9410b41a13044d530fffd33b3ac81bf2e5e24c1db810f89

Contents?: true

Size: 736 Bytes

Versions: 28

Compression:

Stored size: 736 Bytes

Contents

# encoding: utf-8

class ZMQ::Pollitem
  # API that allows poll items to send data regardless of the underlying pollable item type (ZMQ::Socket or IO).
  #
  def send(*args)
    case pollable
    when BasicSocket
      pollable.send(args.shift, 0)
    when IO
      pollable.write_nonblock(*args)
    when ZMQ::Socket
      pollable.send(*args)
    end
  end

  # API that allows poll items to recv data regardless of the underlying pollable item type (ZMQ::Socket or IO).
  #
  def recv
    case pollable
    when BasicSocket
      # XXX assumed page size
      pollable.recv_nonblock(4096)
    when IO
      # XXX assumed page size
      pollable.read_nonblock(4096)
    when ZMQ::Socket
      pollable.recv_nonblock
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rbczmq-1.7.9 lib/zmq/pollitem.rb
rbczmq-1.7.8 lib/zmq/pollitem.rb
rbczmq-1.7.7 lib/zmq/pollitem.rb
rbczmq-1.7.6 lib/zmq/pollitem.rb
rbczmq-1.7.5 lib/zmq/pollitem.rb
rbczmq-1.7.4 lib/zmq/pollitem.rb
rbczmq-1.7.3 lib/zmq/pollitem.rb
rbczmq-1.7.2 lib/zmq/pollitem.rb
rbczmq-1.7.1 lib/zmq/pollitem.rb
rbczmq-1.7.0 lib/zmq/pollitem.rb
rbczmq-1.6.4 lib/zmq/pollitem.rb
rbczmq-1.6.2 lib/zmq/pollitem.rb
rbczmq-1.6 lib/zmq/pollitem.rb
rbczmq-1.5 lib/zmq/pollitem.rb
rbczmq-1.4 lib/zmq/pollitem.rb
rbczmq-1.3 lib/zmq/pollitem.rb
rbczmq-1.2 lib/zmq/pollitem.rb
rbczmq-1.1 lib/zmq/pollitem.rb
rbczmq-1.0 lib/zmq/pollitem.rb
rbczmq-0.9 lib/zmq/pollitem.rb