Class: GVariantBooleanType

Inherits:
GVariantBasicType show all
Defined in:
lib/gvariant.rb

Instance Attribute Summary

Attributes inherited from GVariantBasicType

#alignment, #default_value, #fixed_size, #id

Instance Method Summary collapse

Methods inherited from GVariantBasicType

#align, #pad

Constructor Details

#initializeGVariantBooleanType

Returns a new instance of GVariantBooleanType.



79
80
81
# File 'lib/gvariant.rb', line 79

def initialize
  super('b', 'C', 1, 1, false)
end

Instance Method Details

#read(buf) ⇒ Object



83
84
85
86
# File 'lib/gvariant.rb', line 83

def read(buf)
  b = super(buf)
  b != false && b != 0
end

#write(value) ⇒ Object



88
89
90
# File 'lib/gvariant.rb', line 88

def write(value)
  super((value != 0 && value != false && value != nil) ? 1: 0)
end