Sha256: b6eaa163c723b450b1bad37eab6f64ac247cdadfef9016a6c350df75cd0bc8b8

Contents?: true

Size: 456 Bytes

Versions: 7

Compression:

Stored size: 456 Bytes

Contents

module GLib
  module ContainerClassMethods
    def wrap typespec, ptr
      super(ptr).tap do |container|
        container.reset_typespec typespec if container
      end
    end

    def from typespec, it
      case it
      when nil
        nil
      when FFI::Pointer
        wrap typespec, it
      when self
        # TODO: Reset or check?
        it.reset_typespec typespec
      else
        from_enumerable typespec, it
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gir_ffi-0.6.6 lib/ffi-glib/container_class_methods.rb
gir_ffi-0.6.5 lib/ffi-glib/container_class_methods.rb
gir_ffi-0.6.4 lib/ffi-glib/container_class_methods.rb
gir_ffi-0.6.3 lib/ffi-glib/container_class_methods.rb
gir_ffi-0.6.2 lib/ffi-glib/container_class_methods.rb
gir_ffi-0.6.1 lib/ffi-glib/container_class_methods.rb
gir_ffi-0.6.0 lib/ffi-glib/container_class_methods.rb