Module: ZMQ::Util

Included in:
Context, Message, Poller, Socket
Defined in:
lib/ffi-rzmq/zmq.rb

Overview

These methods don’t belong to any specific context. They get included in the #Context, #Socket and #Poller classes.

Instance Method Summary collapse

Instance Method Details

#errnoObject

Returns the errno as set by the libzmq library.



75
76
77
# File 'lib/ffi-rzmq/zmq.rb', line 75

def errno
  LibZMQ.zmq_errno
end

#error_stringObject

Returns a string corresponding to the currently set #errno. These error strings are defined by libzmq.



82
83
84
# File 'lib/ffi-rzmq/zmq.rb', line 82

def error_string
  LibZMQ.zmq_strerror(errno).read_string
end

#versionObject

Returns an array of the form [major, minor, patch] to represent the version of libzmq.



89
90
91
92
93
94
95
# File 'lib/ffi-rzmq/zmq.rb', line 89

def version
  major = FFI::MemoryPointer.new :int
  minor = FFI::MemoryPointer.new :int
  patch = FFI::MemoryPointer.new :int
  LibZMQ.zmq_version major, minor, patch
  [major.read_int, minor.read_int, patch.read_int]
end