Sha256: 72c411cc263040a6d6347b4197445f0a437e3e38df662876a068825f12226b6e

Contents?: true

Size: 456 Bytes

Versions: 4

Compression:

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

4 entries across 4 versions & 1 rubygems

Version Path
gir_ffi-0.15.3 lib/ffi-glib/list.rb
gir_ffi-0.15.2 lib/ffi-glib/list.rb
gir_ffi-0.15.1 lib/ffi-glib/list.rb
gir_ffi-0.15.0 lib/ffi-glib/list.rb