Sha256: 7147636bbd9399cab86a2a3673f664e6e422b72bdadd1cd7f13de7cb0ea1ad49

Contents?: true

Size: 754 Bytes

Versions: 7

Compression:

Stored size: 754 Bytes

Contents

module GirFFI
  module InfoExt
    # Extensions for GObjectIntrospection::IArgInfo needed by GirFFI
    module IArgInfo
      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

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

GObjectIntrospection::IArgInfo.send :include, GirFFI::InfoExt::IArgInfo

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gir_ffi-0.6.6 lib/gir_ffi/info_ext/i_arg_info.rb
gir_ffi-0.6.5 lib/gir_ffi/info_ext/i_arg_info.rb
gir_ffi-0.6.4 lib/gir_ffi/info_ext/i_arg_info.rb
gir_ffi-0.6.3 lib/gir_ffi/info_ext/i_arg_info.rb
gir_ffi-0.6.2 lib/gir_ffi/info_ext/i_arg_info.rb
gir_ffi-0.6.1 lib/gir_ffi/info_ext/i_arg_info.rb
gir_ffi-0.6.0 lib/gir_ffi/info_ext/i_arg_info.rb