Class: GObjectIntrospection::Strv
- Inherits:
-
Object
- Object
- GObjectIntrospection::Strv
- Includes:
- Enumerable
- Defined in:
- lib/ffi-gobject_introspection/strv.rb
Overview
Represents a null-terminated array of strings. GLib uses this construction, but does not provide any actual functions for this class.
Direct Known Subclasses
Constant Summary collapse
- POINTER_SIZE =
FFI.type_size(:pointer)
Class Method Summary collapse
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(ptr) ⇒ Strv
constructor
A new instance of Strv.
- #to_ptr ⇒ Object
Constructor Details
#initialize(ptr) ⇒ Strv
Returns a new instance of Strv.
13 14 15 |
# File 'lib/ffi-gobject_introspection/strv.rb', line 13 def initialize(ptr) @ptr = ptr end |
Class Method Details
.wrap(ptr) ⇒ Object
29 30 31 |
# File 'lib/ffi-gobject_introspection/strv.rb', line 29 def self.wrap(ptr) new ptr end |
Instance Method Details
#each ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/ffi-gobject_introspection/strv.rb', line 21 def each offset = 0 while (ptr = fetch_ptr offset) offset += POINTER_SIZE yield ptr.read_string end end |
#to_ptr ⇒ Object
17 18 19 |
# File 'lib/ffi-gobject_introspection/strv.rb', line 17 def to_ptr @ptr end |