Class: Aerospike::BoolValue

Inherits:
Value
  • Object
show all
Defined in:
lib/aerospike/value/value.rb

Overview

Boolean value. Supported by Aerospike server 5.6+ only.

Instance Method Summary collapse

Methods inherited from Value

of, validate_hash_key

Constructor Details

#initialize(val) ⇒ BoolValue

:nodoc:



667
668
669
670
# File 'lib/aerospike/value/value.rb', line 667

def initialize(val)
  @value = val || false
  self
end

Instance Method Details

#estimate_sizeObject



672
673
674
# File 'lib/aerospike/value/value.rb', line 672

def estimate_size
  1
end

#getObject



690
691
692
# File 'lib/aerospike/value/value.rb', line 690

def get
  @value
end

#pack(packer) ⇒ Object



682
683
684
# File 'lib/aerospike/value/value.rb', line 682

def pack(packer)
  packer.write(@value)
end

#to_bytesObject



694
695
696
# File 'lib/aerospike/value/value.rb', line 694

def to_bytes
  @value.ord
end

#to_sObject



698
699
700
# File 'lib/aerospike/value/value.rb', line 698

def to_s
  @value.to_s
end

#typeObject



686
687
688
# File 'lib/aerospike/value/value.rb', line 686

def type
  Aerospike::ParticleType::BOOL
end

#write(buffer, offset) ⇒ Object



676
677
678
679
680
# File 'lib/aerospike/value/value.rb', line 676

def write(buffer, offset)
  val = @value ? 1 : 0
  buffer.write_byte(val.ord, offset)
  1
end