Class: GirFFI::Builder::Type::Callback

Inherits:
Base
  • Object
show all
Defined in:
lib/gir_ffi/builder/type/callback.rb

Overview

Implements the creation of a callback type. The type will be attached to the appropriate namespace module, and will be defined as a callback for FFI.

Instance Attribute Summary

Attributes inherited from Base

#info

Instance Method Summary collapse

Methods inherited from Base

#build_class, #initialize

Methods included from GirFFI::BuilderHelper

#const_defined_for, #optionally_define_constant

Constructor Details

This class inherits a constructor from GirFFI::Builder::Type::Base

Instance Method Details

#argument_typesObject



20
21
22
# File 'lib/gir_ffi/builder/type/callback.rb', line 20

def argument_types
  @info.argument_ffi_types
end

#callback_symObject



16
17
18
# File 'lib/gir_ffi/builder/type/callback.rb', line 16

def callback_sym
  @classname.to_sym
end

#instantiate_classObject



10
11
12
13
14
# File 'lib/gir_ffi/builder/type/callback.rb', line 10

def instantiate_class
  @klass = optionally_define_constant namespace_module, @classname do
    lib.callback callback_sym, argument_types, return_type
  end
end

#return_typeObject



24
25
26
# File 'lib/gir_ffi/builder/type/callback.rb', line 24

def return_type
  @info.return_ffi_type
end