Module: GirFFI::InfoExt::IArgInfo

Defined in:
lib/gir_ffi/info_ext/i_arg_info.rb

Overview

Extensions for GObjectIntrospection::IArgInfo needed by GirFFI

Instance Method Summary collapse

Instance Method Details

#cast_signal_argument(arg) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gir_ffi/info_ext/i_arg_info.rb', line 5

def cast_signal_argument arg
  arg_t = self.argument_type
  if arg_t.tag == :interface
    iface = arg_t.interface
    kls = GirFFI::Builder.build_class iface
    case iface.info_type
    when :enum, :flags
      kls[arg]
    when :interface
      arg.to_object
    else
      kls.wrap(arg)
    end
  else
    arg
  end
end

#to_ffitypeObject



23
24
25
26
# File 'lib/gir_ffi/info_ext/i_arg_info.rb', line 23

def to_ffitype
  return :pointer if direction != :in
  return argument_type.to_ffitype
end