Sha256: 38bcc76c32e3b238521fc778e4d4d7b8f410a2d690cad0a22677a4dc237deb06
Contents?: true
Size: 439 Bytes
Versions: 8
Compression:
Stored size: 439 Bytes
Contents
require 'ffi-glib/list_methods' GLib.load_class :SList module GLib # Overrides for GSList, GLib's singly-linked list implementation. class SList include ListMethods def self.from_enumerable(type, arr) arr.reverse.reduce(new type) { |lst, val| lst.prepend val } end def prepend(data) self.class.wrap(element_type, Lib.g_slist_prepend(self, element_ptr_for(data))) end end end
Version data entries
8 entries across 8 versions & 1 rubygems