class GVariantMaybeType
Public Class Methods
new(id, maybe_element)
click to toggle source
Calls superclass method
GVariantBasicType::new
# File lib/gvariant.rb, line 105 def initialize(id, maybe_element) super(id, nil, maybe_element.alignment, nil, nil) @element = maybe_element end
Public Instance Methods
read(buf)
click to toggle source
# File lib/gvariant.rb, line 110 def read(buf) l = buf.length # Nothing return nil if l == 0 # Just if (@element.fixed_size) return nil if l != @element.fixed_size @element.read(buf) else @element.read(buf[0..l - 1]) end end
write(val)
click to toggle source
# File lib/gvariant.rb, line 125 def write(val) if val buf = @element.write(val) buf.concat(0) unless @element.fixed_size buf else "" end end