Module: GLib::ListMethods
Instance Attribute Summary collapse
-
#element_type ⇒ Object
Returns the value of attribute element_type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#element_type ⇒ Object
Returns the value of attribute element_type.
6 7 8 |
# File 'lib/ffi-glib/list_methods.rb', line 6 def element_type @element_type end |
Class Method Details
.included(base) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/ffi-glib/list_methods.rb', line 8 def self.included base base.extend ContainerClassMethods # Override default field accessors. replace_method base, :next, :tail replace_method base, :data, :head end |
.replace_method(base, old, new) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/ffi-glib/list_methods.rb', line 15 def self.replace_method base, old, new base.class_eval do remove_method old alias_method old, new end end |
Instance Method Details
#each ⇒ Object
22 23 24 25 26 27 |
# File 'lib/ffi-glib/list_methods.rb', line 22 def each reset_iterator while (elem = next_element) yield elem end end |
#head ⇒ Object
33 34 35 |
# File 'lib/ffi-glib/list_methods.rb', line 33 def head GirFFI::ArgHelper.cast_from_pointer(element_type, @struct[:data]) end |
#reset_typespec(typespec) ⇒ Object
37 38 39 40 |
# File 'lib/ffi-glib/list_methods.rb', line 37 def reset_typespec typespec self.element_type = typespec self end |
#tail ⇒ Object
29 30 31 |
# File 'lib/ffi-glib/list_methods.rb', line 29 def tail self.class.wrap(element_type, @struct[:next]) end |