Class: GLib::ByteArray
- Inherits:
-
Object
- Object
- GLib::ByteArray
- Defined in:
- lib/ffi-glib/byte_array.rb
Overview
Overrides for GByteArray, GLib’s automatically growing array of bytes.
Instance Method Summary collapse
- #append(data) ⇒ Object
-
#initialize ⇒ ByteArray
constructor
A new instance of ByteArray.
- #to_string ⇒ Object
Constructor Details
Instance Method Details
#append(data) ⇒ Object
11 12 13 14 15 |
# File 'lib/ffi-glib/byte_array.rb', line 11 def append(data) bytes = GirFFI::InPointer.from_utf8 data len = data.bytesize self.class.wrap Lib.g_byte_array_append(to_ptr, bytes, len) end |
#to_string ⇒ Object
7 8 9 |
# File 'lib/ffi-glib/byte_array.rb', line 7 def to_string data.read_string len end |