Module: GLib::ContainerClassMethods
Overview
Common methods for container classes: Array, PtrArray, List, SList and HashTable.
Instance Method Summary collapse
-
#from(*args) ⇒ Object
FIXME: Drop Ruby 1.8.7 support and make first argument optional.
- #wrap(typespec, ptr) ⇒ Object
Instance Method Details
#from(*args) ⇒ Object
FIXME: Drop Ruby 1.8.7 support and make first argument optional.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ffi-glib/container_class_methods.rb', line 12 def from *args it, typespec = *args.reverse typespec ||= :void 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
5 6 7 8 9 |
# File 'lib/ffi-glib/container_class_methods.rb', line 5 def wrap typespec, ptr super(ptr).tap do |container| container.reset_typespec typespec if container end end |