Sha256: f07470df4ccc7787dc57da9a90280d031c42a1c432e621c9d8634d050e04f03e

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

# frozen_string_literal: true

module Lxi
  # Initialise the LXI library
  def self.init_session
    raise(Error, 'LXI Library not found') unless LibChecker.installed?(LIBLXI_PATHS)
    raise(Error, 'LXI Library Initialisation Error') unless Lxi.init == LXI_OK

    true
  end

  module LibChecker
    extend FFI::Library

    def self.installed?(lib_paths = [])
      lib_paths.each do |path|
        ffi_lib path
        return true
      rescue LoadError
        next
      end
      false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lxi_rb-0.10.5 lib/lxi/methods.rb
lxi_rb-0.10.4 lib/lxi/methods.rb
lxi_rb-0.10.3 lib/lxi/methods.rb
lxi_rb-0.10.1 lib/lxi/methods.rb