Class: Aerospike::ListValue
Overview
List value. Supported by Aerospike 3 servers only.
Instance Method Summary collapse
- #estimate_size ⇒ Object
- #get ⇒ Object
-
#initialize(list) ⇒ ListValue
constructor
:nodoc:.
- #pack(packer) ⇒ Object
- #to_bytes ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
- #write(buffer, offset) ⇒ Object
Methods inherited from Value
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_size ⇒ Object
376 377 378 |
# File 'lib/aerospike/value/value.rb', line 376 def estimate_size bytes.bytesize end |
#get ⇒ Object
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_bytes ⇒ Object
400 401 402 |
# File 'lib/aerospike/value/value.rb', line 400 def to_bytes bytes end |
#to_s ⇒ Object
404 405 406 |
# File 'lib/aerospike/value/value.rb', line 404 def to_s @list.map { |v| v.to_s }.to_s end |
#type ⇒ Object
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 |