Class: GirFFI::Builders::ClosureToPointerConvertor

Inherits:
Object
  • Object
show all
Defined in:
lib/gir_ffi/builders/closure_to_pointer_convertor.rb

Overview

Builder that generates code to convert closure arguments (‘user data’) from Ruby to C. Used by argument builders.

Instance Method Summary collapse

Constructor Details

#initialize(argument_name, callback_argument) ⇒ ClosureToPointerConvertor

Returns a new instance of ClosureToPointerConvertor.



6
7
8
9
# File 'lib/gir_ffi/builders/closure_to_pointer_convertor.rb', line 6

def initialize(argument_name, callback_argument)
  @argument_name = argument_name
  @callback_argument = callback_argument
end

Instance Method Details

#conversionObject



11
12
13
# File 'lib/gir_ffi/builders/closure_to_pointer_convertor.rb', line 11

def conversion
  "GirFFI::InPointer.from_closure_data(#{callback_argument_name}.object_id)"
end