Sha256: 0dfbebe98438105da604c43e8e4b852daf7636da173215b93838b2780ec6df30
Contents?: true
Size: 904 Bytes
Versions: 4
Compression:
Stored size: 904 Bytes
Contents
# frozen_string_literal: true module GLib # Common methods for container classes: Array, PtrArray, List, SList and # HashTable. module ContainerClassMethods def wrap(typespec, ptr) # HACK: wrap and from are almost the same! ptr = case ptr when nil nil when FFI::Pointer ptr when self ptr.to_ptr when GirFFI::BoxedBase ptr.to_ptr end super(ptr).tap do |container| container.reset_typespec typespec if container end end def from(typespec = :void, obj) case obj when nil nil when FFI::Pointer wrap typespec, obj when self obj.reset_typespec typespec when GirFFI::BoxedBase wrap typespec, obj.to_ptr else from_enumerable typespec, obj end end end end
Version data entries
4 entries across 4 versions & 1 rubygems