Class: GLib::List

Inherits:
Object
  • Object
show all
Includes:
ListMethods
Defined in:
lib/ffi-glib/list.rb

Overview

Overrides for GList, GLib’s doubly linked list implementation.

Instance Attribute Summary

Attributes included from ListMethods

#element_type

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ListMethods

#==, #each, #head, included, replace_method, #reset_typespec, #tail

Class Method Details

.from_enumerable(type, arr) ⇒ Object



10
11
12
# File 'lib/ffi-glib/list.rb', line 10

def self.from_enumerable type, arr
  arr.inject(self.new type) { |lst, val| lst.append val }
end

Instance Method Details

#append(data) ⇒ Object



14
15
16
17
# File 'lib/ffi-glib/list.rb', line 14

def append data
  self.class.wrap(element_type,
                  Lib.g_list_append(self, element_ptr_for(data)))
end