class GLib::List

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

Public Class Methods

from_enumerable(type, arr) click to toggle source
# File lib/ffi-glib/list.rb, line 22
def self.from_enumerable type, arr
  arr.inject(self.new type) { |lst, val|
    lst.append val }
end
new(type) click to toggle source
# File lib/ffi-glib/list.rb, line 14
def self.new type
  _real_new.tap do |it|
    struct = self::Struct.new(FFI::Pointer.new(0))
    it.instance_variable_set :@struct, struct
    it.element_type = type
  end
end

Public Instance Methods

append(data) click to toggle source
# File lib/ffi-glib/list.rb, line 27
def append data
  elm_t = element_type
  data_ptr = GirFFI::InPointer.from(elm_t, data)
  self.class.wrap(elm_t, Lib.g_list_append(self, data_ptr))
end