Module: 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, 3.x and 4.x APIs.

Defined Under Namespace

Modules: PollItemLayout Classes: Msg, PollItem

Constant Summary collapse

ZMQ_LIB_PATHS =
[
inside_gem, '/usr/local/lib', '/opt/local/lib', '/usr/local/homebrew/lib', '/usr/lib64'
].map{|path| "#{path}/libzmq.#{FFI::Platform::LIBSUFFIX}"}

Class Method Summary collapse

Class Method Details

.versionObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/ffi-rzmq/libzmq.rb', line 44

def self.version
  unless @version
    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)


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

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

.version3?Boolean

Returns:

  • (Boolean)


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

def self.version3?() version[:major] == 3 end

.version4?Boolean

Returns:

  • (Boolean)


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

def self.version4?() version[:major] == 4 end