Sha256: d7428834be0103ed9366ae04d16fc8d7db817a3ae107071b160bb24702599a83

Contents?: true

Size: 518 Bytes

Versions: 25

Compression:

Stored size: 518 Bytes

Contents

module GLib
  load_class :ByteArray

  # 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 self.to_ptr, bytes, len)
    end

    class << self
      undef :new
      def new
        wrap(Lib.g_byte_array_new)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
gir_ffi-0.7.2 lib/ffi-glib/byte_array.rb
gir_ffi-0.7.1 lib/ffi-glib/byte_array.rb
gir_ffi-0.7.0 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.7 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.6 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.5 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.4 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.3 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.2 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.1 lib/ffi-glib/byte_array.rb
gir_ffi-0.6.0 lib/ffi-glib/byte_array.rb
gir_ffi-0.5.2 lib/ffi-glib/byte_array.rb
gir_ffi-0.5.1 lib/ffi-glib/byte_array.rb
gir_ffi-0.5.0 lib/ffi-glib/byte_array.rb
gir_ffi-0.4.3 lib/ffi-glib/byte_array.rb
gir_ffi-0.4.2 lib/ffi-glib/byte_array.rb
gir_ffi-0.4.1 lib/ffi-glib/byte_array.rb
gir_ffi-0.4.0 lib/ffi-glib/byte_array.rb
gir_ffi-0.3.2 lib/ffi-glib/byte_array.rb
gir_ffi-0.3.1 lib/ffi-glib/byte_array.rb