Sha256: b8f76efa44245a830ed6a592bf8501eefa8f42b49003c38969a188c522f8c873

Contents?: true

Size: 437 Bytes

Versions: 5

Compression:

Stored size: 437 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

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-0.7.10 lib/ffi-glib/s_list.rb
gir_ffi-0.7.9 lib/ffi-glib/s_list.rb
gir_ffi-0.7.8 lib/ffi-glib/s_list.rb
gir_ffi-0.7.7 lib/ffi-glib/s_list.rb
gir_ffi-0.7.6 lib/ffi-glib/s_list.rb