Sha256: b04a29eb5798c16038385af87f4bcef3f86004dda2f811ca3d6f72c73976b86e

Contents?: true

Size: 439 Bytes

Versions: 5

Compression:

Stored size: 439 Bytes

Contents

require 'ffi-glib/list_methods'

module GLib
  load_class :SList

  # Overrides for GSList, GLib's singly-linked list implementation.
  class SList
    include ListMethods

    def self.from_enumerable type, arr
      arr.reverse.inject(self.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.4 lib/ffi-glib/s_list.rb
gir_ffi-0.7.3 lib/ffi-glib/s_list.rb
gir_ffi-0.7.2 lib/ffi-glib/s_list.rb
gir_ffi-0.7.1 lib/ffi-glib/s_list.rb
gir_ffi-0.7.0 lib/ffi-glib/s_list.rb