Module: GLib::ContainerClassMethods

Included in:
HashTable
Defined in:
lib/ffi-glib/container_class_methods.rb

Instance Method Summary collapse

Instance Method Details

#from(typespec, it) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ffi-glib/container_class_methods.rb', line 9

def from typespec, it
  case it
  when nil
    nil
  when FFI::Pointer
    wrap typespec, it
  when self
    it.reset_typespec typespec
  else
    from_enumerable typespec, it
  end
end

#wrap(typespec, ptr) ⇒ Object



3
4
5
6
7
# File 'lib/ffi-glib/container_class_methods.rb', line 3

def wrap typespec, ptr
  if (it = super(ptr))
    it.reset_typespec typespec
  end
end