Class: ZooKeeper::ZKBoolean

Inherits:
BinData::BasePrimitive
  • Object
show all
Defined in:
lib/zkruby/bindata.rb

Overview

This doesn’t work as expected, because when used in a record you get a ZKBoolean instance back which cannot be compared to “false” you must call snapshot or compare with == false

Instance Method Summary collapse

Instance Method Details

#read_and_return_value(io) ⇒ Object



34
35
36
37
# File 'lib/zkruby/bindata.rb', line 34

def read_and_return_value(io)
    intval = io.readbytes(1).unpack("C").at(0)
    intval != 0
end

#sensible_defaultObject



39
40
41
# File 'lib/zkruby/bindata.rb', line 39

def sensible_default
    false
end

#value_to_binary_string(v) ⇒ Object



29
30
31
32
# File 'lib/zkruby/bindata.rb', line 29

def value_to_binary_string(v)
    intval = v ? 1 : 0
    [ intval ].pack("C")
end