Module: ZMQ::LibZMQ

Extended by:
FFI::Library
Defined in:
lib/ffi-rzmq/libzmq.rb,
lib/ffi-rzmq/libzmq.rb,
lib/ffi-rzmq/libzmq.rb

Overview

Wraps the libzmq library and attaches to the functions that are common across the 2.x and 3.x APIs.

Defined Under Namespace

Modules: EventDataLayout, PollItemLayout Classes: EventData, Msg, PollItem

Class Method Summary collapse

Class Method Details

.versionObject



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/ffi-rzmq/libzmq.rb', line 58

def self.version
  if @version.nil?
    major = FFI::MemoryPointer.new :int
    minor = FFI::MemoryPointer.new :int
    patch = FFI::MemoryPointer.new :int
    LibZMQ.zmq_version major, minor, patch
    @version = {:major => major.read_int, :minor => minor.read_int, :patch => patch.read_int}
  end

  @version
end

.version2?Boolean

Returns:

  • (Boolean)


70
# File 'lib/ffi-rzmq/libzmq.rb', line 70

def self.version2?() version[:major] == 2 && version[:minor] >= 1  end

.version3?Boolean

Returns:

  • (Boolean)


72
# File 'lib/ffi-rzmq/libzmq.rb', line 72

def self.version3?() version[:major] == 3 && version[:minor] >= 2 end