Sha256: 31996bc0eb4e5cc6c8a69aac8cb251ccf0bbdcad74524f69a1117f2984618757
Contents?: true
Size: 670 Bytes
Versions: 3
Compression:
Stored size: 670 Bytes
Contents
module GLib module ListMethods include Enumerable attr_accessor :element_type def self.included base base.extend ClassMethods end def each list = self rval = nil until list.nil? rval = yield list.head list = list.tail end rval end def tail self.class.wrap(element_type, @struct[:next]) end def head GirFFI::ArgHelper.cast_from_pointer(element_type, @struct[:data]) end module ClassMethods def wrap elmttype, ptr super(ptr).tap do |it| break if it.nil? it.element_type = elmttype end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.2.2 | lib/ffi-glib/list_methods.rb |
gir_ffi-0.2.1 | lib/ffi-glib/list_methods.rb |
gir_ffi-0.2.0 | lib/ffi-glib/list_methods.rb |