Sha256: 90bc010c778b1730252f9c4e7dac583728415e060ed109c2f4fd713a2d648eb1

Contents?: true

Size: 626 Bytes

Versions: 13

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

module Libvirt
  module FFI
    module Helpers
      # Creates function by provided callback or callback name
      # @param callback [Symbol,FFI::CallbackInfo] callback name registered in current module
      # @param args [Array] extra arguments for FFI::Function
      # @yield when function is called
      # @return [FFI::Function]
      def callback_function(callback, *args, &block)
        callback_info = callback.is_a?(Symbol) ? find_type(callback) : callback
        ::FFI::Function.new(callback_info.result_type, callback_info.param_types, *args, &block)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
libvirt_ffi-0.8.1 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.8.0 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.7.0 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.6.2 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.6.1 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.6.0 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.5.6 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.5.5 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.5.4 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.5.3 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.5.2 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.5.1 lib/libvirt/ffi/helpers.rb
libvirt_ffi-0.5.0 lib/libvirt/ffi/helpers.rb