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
permalink #initialize(vmap) ⇒ MapValue
:nodoc:
427 428 429 |
# File 'lib/aerospike/value/value.rb', line 427 def initialize(vmap) @vmap = vmap || {} end |
Instance Method Details
permalink #estimate_size ⇒ Object
[View source]
431 432 433 |
# File 'lib/aerospike/value/value.rb', line 431 def estimate_size bytes.bytesize end |
permalink #get ⇒ Object
[View source]
454 455 456 |
# File 'lib/aerospike/value/value.rb', line 454 def get @vmap end |
permalink #pack(packer) ⇒ Object
[View source]
440 441 442 443 444 445 446 447 448 |
# File 'lib/aerospike/value/value.rb', line 440 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 |
permalink #to_bytes ⇒ Object
[View source]
458 459 460 |
# File 'lib/aerospike/value/value.rb', line 458 def to_bytes bytes end |
permalink #to_s ⇒ Object
[View source]
462 463 464 |
# File 'lib/aerospike/value/value.rb', line 462 def to_s @vmap.map { |k, v| "#{k.to_s} => #{v.to_s}" }.to_s end |
permalink #type ⇒ Object
[View source]
450 451 452 |
# File 'lib/aerospike/value/value.rb', line 450 def type Aerospike::ParticleType::MAP end |
permalink #write(buffer, offset) ⇒ Object
[View source]
435 436 437 438 |
# File 'lib/aerospike/value/value.rb', line 435 def write(buffer, offset) buffer.write_binary(bytes, offset) bytes.bytesize end |