Sha256: d81cf1af0ec8e80103ed814fcf87872aa4800b6018db3947ed514fda26c82123

Contents?: true

Size: 455 Bytes

Versions: 9

Compression:

Stored size: 455 Bytes

Contents

# frozen_string_literal: true
require 'ffi-glib/list_methods'

GLib.load_class :List

module GLib
  # Overrides for GList, GLib's doubly linked list implementation.
  class List
    include ListMethods

    def self.from_enumerable(type, arr)
      arr.reduce(new(type)) { |lst, val| lst.append val }
    end

    def append(data)
      self.class.wrap(element_type,
                      Lib.g_list_append(self, element_ptr_for(data)))
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.11.1 lib/ffi-glib/list.rb
gir_ffi-0.11.0 lib/ffi-glib/list.rb
gir_ffi-0.10.2 lib/ffi-glib/list.rb
gir_ffi-0.10.1 lib/ffi-glib/list.rb
gir_ffi-0.10.0 lib/ffi-glib/list.rb
gir_ffi-0.10.0.pre1 lib/ffi-glib/list.rb
gir_ffi-0.9.5 lib/ffi-glib/list.rb
gir_ffi-0.9.4 lib/ffi-glib/list.rb
gir_ffi-0.9.3 lib/ffi-glib/list.rb