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, #initialize, replace_method, #reset_typespec, #tail

Class Method Details

.from_enumerable(type, arr) ⇒ Object



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

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

Instance Method Details

#append(data) ⇒ Object



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

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