/usr/lib/ruby/vendor_ruby/ffi-rzmq-core/utilities.rb is in ruby-ffi-rzmq-core 1.0.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | module LibZMQ
# Returns a hash of the form {:major => X, :minor => Y, :patch => Z} to represent the
# version of libzmq.
#
# Class method.
#
# Invoke as: ZMQ::LibZMQ.version
#
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
def self.version3?
version[:major] == 3 && version[:minor] >= 2
end
def self.version4?
version[:major] == 4
end
# Sanity check; print an error and exit if we are trying to load an unsupported
# version of libzmq.
#
hash = LibZMQ.version
major, minor = hash[:major], hash[:minor]
if major < 3 || (major == 3 && minor < 2)
version = "#{hash[:major]}.#{hash[:minor]}.#{hash[:patch]}"
raise LoadError, "The libzmq version #{version} is incompatible with this version of ffi-rzmq-core."
end
end
|