Sha256: 986be57c074ed2caf8669ccaa549b2f0adac40585a597fec3a1773cd0d8dc274

Contents?: true

Size: 483 Bytes

Versions: 6

Compression:

Stored size: 483 Bytes

Contents

GLib.load_class :ByteArray

module GLib
  # Overrides for GByteArray, GLib's automatically growing array of bytes.
  class ByteArray
    def to_string
      GirFFI::ArgHelper.ptr_to_utf8_length @struct[:data], @struct[:len]
    end

    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

    def initialize
      store_pointer(Lib.g_byte_array_new)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gir_ffi-0.9.0 lib/ffi-glib/byte_array.rb
gir_ffi-0.8.6 lib/ffi-glib/byte_array.rb
gir_ffi-0.8.5 lib/ffi-glib/byte_array.rb
gir_ffi-0.8.4 lib/ffi-glib/byte_array.rb
gir_ffi-0.8.3 lib/ffi-glib/byte_array.rb
gir_ffi-0.8.2 lib/ffi-glib/byte_array.rb