class GVariantVariantType

Public Class Methods

new() click to toggle source
Calls superclass method GVariantBasicType::new
# File lib/gvariant.rb, line 137
def initialize
  super('v', nil, 8, nil, { type: '()', value: {} })
end

Public Instance Methods

read(buf) click to toggle source
# File lib/gvariant.rb, line 141
def read(buf)
  value, sep, type = buf[0..buf.length - 1].rpartition("\x00")
  { type: type, value: GVariant.read(type, value) }
end
write(variant) click to toggle source
# File lib/gvariant.rb, line 146
def write(variant)
  buf = GVariant.write(variant[:type], variant[:value])
  buf.concat(0)
  buf << variant[:type]
end