Module: GirFFI::InterfaceBase

Includes:
InstanceMethodSetup, MethodSetup, RegisteredTypeBase
Defined in:
lib/gir_ffi/interface_base.rb

Overview

Base module for modules representing GLib interfaces.

Instance Method Summary collapse

Methods included from InstanceMethodSetup

#setup_instance_method, #setup_instance_method!

Methods included from MethodSetup

#setup_method, #setup_method!

Methods included from RegisteredTypeBase

#gtype

Methods included from TypeBase

#gir_ffi_builder, #gir_info

Instance Method Details

#copy_value_to_pointer(value, pointer, offset = 0) ⇒ Object

TODO: Unify with implementation in ObjectBase



22
23
24
# File 'lib/gir_ffi/interface_base.rb', line 22

def copy_value_to_pointer(value, pointer, offset = 0)
  pointer.put_pointer offset, value.to_ptr
end

#setup_and_call(method, arguments, &block) ⇒ Object

Raises:

  • (NoMethodError)


14
15
16
17
18
19
# File 'lib/gir_ffi/interface_base.rb', line 14

def setup_and_call(method, arguments, &block)
  method_name = setup_method method.to_s
  raise NoMethodError, "undefined method `#{method}' for #{self}" unless method_name

  send method_name, *arguments, &block
end

#to_callback_ffi_typeObject



34
35
36
# File 'lib/gir_ffi/interface_base.rb', line 34

def to_callback_ffi_type
  :pointer
end

#to_ffi_typeObject



30
31
32
# File 'lib/gir_ffi/interface_base.rb', line 30

def to_ffi_type
  :pointer
end

#wrap(ptr) ⇒ Object



26
27
28
# File 'lib/gir_ffi/interface_base.rb', line 26

def wrap(ptr)
  ptr.to_object
end