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
10 11 12 13 14 |
# File 'lib/ffi-glib/byte_array.rb', line 10 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
6 7 8 |
# File 'lib/ffi-glib/byte_array.rb', line 6 def to_string GirFFI::ArgHelper.ptr_to_utf8_length @struct[:data], @struct[:len] end |