Class: Aerospike::MapValue
Overview
Map value. Supported by Aerospike 3 servers only.
Instance Method Summary collapse
- #estimate_size ⇒ Object
- #get ⇒ Object
-
#initialize(vmap) ⇒ MapValue
constructor
:nodoc:.
- #pack(packer) ⇒ Object
- #to_bytes ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
- #write(buffer, offset) ⇒ Object
Methods inherited from Value
Constructor Details
#initialize(vmap) ⇒ MapValue
:nodoc:
442 443 444 |
# File 'lib/aerospike/value/value.rb', line 442 def initialize(vmap) @vmap = vmap || {} end |
Instance Method Details
#estimate_size ⇒ Object
446 447 448 |
# File 'lib/aerospike/value/value.rb', line 446 def estimate_size bytes.bytesize end |
#get ⇒ Object
469 470 471 |
# File 'lib/aerospike/value/value.rb', line 469 def get @vmap end |
#pack(packer) ⇒ Object
455 456 457 458 459 460 461 462 463 |
# File 'lib/aerospike/value/value.rb', line 455 def pack(packer) packer.write_map_header(@vmap.length) for key, val in @vmap Value.validate_hash_key(key) Value.of(key).pack(packer) Value.of(val).pack(packer) end end |
#to_bytes ⇒ Object
473 474 475 |
# File 'lib/aerospike/value/value.rb', line 473 def to_bytes bytes end |
#to_s ⇒ Object
477 478 479 |
# File 'lib/aerospike/value/value.rb', line 477 def to_s @vmap.map{|k, v| "#{k.to_s} => #{v.to_s}" }.to_s end |
#type ⇒ Object
465 466 467 |
# File 'lib/aerospike/value/value.rb', line 465 def type Aerospike::ParticleType::MAP end |
#write(buffer, offset) ⇒ Object
450 451 452 453 |
# File 'lib/aerospike/value/value.rb', line 450 def write(buffer, offset) buffer.write_binary(bytes, offset) bytes.bytesize end |