The InPointer class handles conversion from ruby types to pointers for arguments with direction :in. This is used for arguments that are arrays, strings, or interfaces.
# File lib/gir_ffi/in_pointer.rb, line 18 def self.from type, val return nil if val.nil? case type when Array arr_t, sub_t = *type # TODO: Take array type into account (zero-terminated or not) self.from_array sub_t, val when :utf8, :filename from_utf8 val when :gint32, :gint8 self.new val when :void ArgHelper.object_to_inptr val else raise NotImplementedError end end
# File lib/gir_ffi/in_pointer.rb, line 6 def self.from_array type, ary return nil if ary.nil? case type when :utf8, :filename from_utf8_array ary when :interface_pointer from_interface_pointer_array ary else from_basic_type_array type, ary end end