class FFI::VariadicInvoker
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/ffi/variadic.rbs class FFI::VariadicInvoker def call: (*Array[FFI::AutoPointer] args, ) -> Symbol end
def attach(mod, mname)
Attach the invoker to module +mod+ as +mname+
def attach(mod, mname) invoker = self params = "*args" call = "call" mod.module_eval <<-code @@#{mname} = invoker def self.#{mname}(#{params}) @@#{mname}.#{call}(#{params}) end def #{mname}(#{params}) @@#{mname}.#{call}(#{params}) end code invoker end
def call(*args, &block)
Experimental RBS support (using type sampling data from the type_fusion
project).
type FFI__VariadicInvoker_call_args = Symbol | Symbol | FFI::MemoryPointer | Integer | Symbol | String | Integer | Symbol | Proc | Integer | Symbol | Integer | Integer | Symbol | FFI::MemoryPointer | Integer | Symbol | FFI::Pointer def call: (*FFI__VariadicInvoker_call_args args, ) -> Symbol
This signature was generated using 1922 samples from 5 applications.
def call(*args, &block) param_types = Array.new(@fixed) param_values = Array.new @fixed.each_with_index do |t, i| param_values << args[i] end i = @fixed.length while i < args.length param_types << FFI.find_type(args[i], @type_map) param_values << args[i + 1] i += 2 end invoke(param_types, param_values, &block) end