Sha256: 1fa1828f18ab37f12abbde2b9287425bb1b3b7d247a773b19197bc488c2c79f4

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

module Libvirt
  module Ruby
    class Util
      extend FFI::Library

      def self.dispatcher(method, args = [], return_type = nil)
        begin
          ffi_lib "libvirt"
          attach_function (self.klass + method.to_s), (self.klass + method.to_s), args, return_type
          send (self.klass + method.to_s), args
        rescue FFI::NotFoundError
          raise Libvirt::Ruby::Exceptions::InvalidFunction.new(self.klass + method.to_s)
        rescue LoadError
          raise Libvirt::Ruby::Exceptions::MissingLib
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
libvirt-ruby-0.0.4 lib/libvirt-ruby/util.rb