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:



638
639
640
641
# File 'lib/aerospike/value/value.rb', line 638

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

Instance Method Details

#estimate_sizeObject



643
644
645
# File 'lib/aerospike/value/value.rb', line 643

def estimate_size
  1
end

#getObject



661
662
663
# File 'lib/aerospike/value/value.rb', line 661

def get
  @value
end

#pack(packer) ⇒ Object



653
654
655
# File 'lib/aerospike/value/value.rb', line 653

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

#to_bytesObject



665
666
667
# File 'lib/aerospike/value/value.rb', line 665

def to_bytes
  @value.ord
end

#to_sObject



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

def to_s
  @value.to_s
end

#typeObject



657
658
659
# File 'lib/aerospike/value/value.rb', line 657

def type
  Aerospike::ParticleType::BOOL
end

#write(buffer, offset) ⇒ Object



647
648
649
650
651
# File 'lib/aerospike/value/value.rb', line 647

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