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:
373 374 375 |
# File 'lib/aerospike/value/value.rb', line 373 def initialize(list) @list = list || [] end |
Instance Method Details
#estimate_size ⇒ Object
377 378 379 |
# File 'lib/aerospike/value/value.rb', line 377 def estimate_size bytes.bytesize end |
#get ⇒ Object
397 398 399 |
# File 'lib/aerospike/value/value.rb', line 397 def get @list end |
#pack(packer) ⇒ Object
386 387 388 389 390 391 |
# File 'lib/aerospike/value/value.rb', line 386 def pack(packer) packer.write_array_header(@list.length) for val in @list Value.of(val).pack(packer) end end |
#to_bytes ⇒ Object
401 402 403 |
# File 'lib/aerospike/value/value.rb', line 401 def to_bytes bytes end |
#to_s ⇒ Object
405 406 407 |
# File 'lib/aerospike/value/value.rb', line 405 def to_s @list.map{|v| v.to_s}.to_s end |
#type ⇒ Object
393 394 395 |
# File 'lib/aerospike/value/value.rb', line 393 def type Aerospike::ParticleType::LIST end |
#write(buffer, offset) ⇒ Object
381 382 383 384 |
# File 'lib/aerospike/value/value.rb', line 381 def write(buffer, offset) buffer.write_binary(bytes, offset) bytes.bytesize end |