Class: Aerospike::ListValue

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

Overview

List value. Supported by Aerospike 3 servers only.

Instance Method Summary collapse

Methods inherited from Value

of, validate_hash_key

Constructor Details

#initialize(list) ⇒ ListValue

:nodoc:



372
373
374
# File 'lib/aerospike/value/value.rb', line 372

def initialize(list)
  @list = list || []
end

Instance Method Details

#estimate_sizeObject



376
377
378
# File 'lib/aerospike/value/value.rb', line 376

def estimate_size
  bytes.bytesize
end

#getObject



396
397
398
# File 'lib/aerospike/value/value.rb', line 396

def get
  @list
end

#pack(packer) ⇒ Object



385
386
387
388
389
390
# File 'lib/aerospike/value/value.rb', line 385

def pack(packer)
  packer.write_array_header(@list.length)
  for val in @list
    Value.of(val).pack(packer)
  end
end

#to_bytesObject



400
401
402
# File 'lib/aerospike/value/value.rb', line 400

def to_bytes
  bytes
end

#to_sObject



404
405
406
# File 'lib/aerospike/value/value.rb', line 404

def to_s
  @list.map { |v| v.to_s }.to_s
end

#typeObject



392
393
394
# File 'lib/aerospike/value/value.rb', line 392

def type
  Aerospike::ParticleType::LIST
end

#write(buffer, offset) ⇒ Object



380
381
382
383
# File 'lib/aerospike/value/value.rb', line 380

def write(buffer, offset)
  buffer.write_binary(bytes, offset)
  bytes.bytesize
end