Sha256: de76f78aef1afd07a730572942c448f576ae71bd9b5b79b7cf2ebfb4a441fa5d
Contents?: true
Size: 470 Bytes
Versions: 9
Compression:
Stored size: 470 Bytes
Contents
# frozen_string_literal: true 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
9 entries across 9 versions & 1 rubygems