Sha256: 2e86e5408a4eb4d494882e763e6e6e5a899708ace306e3406d6806d71d81a955

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 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|
        begin
          ffi_lib path
          return true
        rescue LoadError
          next
        end
      end
      false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lxi_rb-0.10.0 lib/lxi/methods.rb
lxi_rb-0.9.0 lib/lxi/methods.rb