Class: GLib::Strv
- Inherits:
-
Object
- Object
- GLib::Strv
- Includes:
- Enumerable
- Defined in:
- lib/ffi-glib/strv.rb,
lib/gir_ffi-base/glib/strv.rb
Overview
Represents a null-terminated array of strings. GLib uses this construction, but does not provide any actual functions for this class.
Constant Summary collapse
- POINTER_SIZE =
FFI.type_size(:pointer)
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #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.
11 12 13 |
# File 'lib/gir_ffi-base/glib/strv.rb', line 11 def initialize ptr @ptr = ptr end |
Class Method Details
.from(it) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ffi-glib/strv.rb', line 8 def self.from it case it when nil nil when FFI::Pointer wrap it when self it else from_enumerable it end end |
.from_enumerable(enum) ⇒ Object
21 22 23 |
# File 'lib/ffi-glib/strv.rb', line 21 def self.from_enumerable enum wrap GirFFI::InPointer.from_array :utf8, enum end |
.wrap(ptr) ⇒ Object
26 27 28 |
# File 'lib/gir_ffi-base/glib/strv.rb', line 26 def self.wrap ptr new ptr end |
Instance Method Details
#==(other) ⇒ Object
4 5 6 |
# File 'lib/ffi-glib/strv.rb', line 4 def == other to_a == other.to_a end |
#each ⇒ Object
19 20 21 22 23 24 |
# File 'lib/gir_ffi-base/glib/strv.rb', line 19 def each reset_iterator or return while (ptr = next_ptr) yield ptr.read_string end end |
#to_ptr ⇒ Object
15 16 17 |
# File 'lib/gir_ffi-base/glib/strv.rb', line 15 def to_ptr @ptr end |