Class: Aerospike::GeoJSONValue
- Defined in:
- lib/aerospike/value/value.rb
Overview
GeoJSON value. Supported by Aerospike server version 3.7 and later.
Constant Summary
Constants inherited from Value
Instance Method Summary collapse
- #estimate_size ⇒ Object
- #get ⇒ Object
-
#initialize(json) ⇒ GeoJSONValue
constructor
:nodoc:.
- #pack(packer) ⇒ Object
- #to_bytes ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
- #write(buffer, offset) ⇒ Object
Methods inherited from Value
Constructor Details
#initialize(json) ⇒ GeoJSONValue
:nodoc:
460 461 462 463 464 |
# File 'lib/aerospike/value/value.rb', line 460 def initialize(json) @json = json @bytes = json.to_json self end |
Instance Method Details
#estimate_size ⇒ Object
466 467 468 469 |
# File 'lib/aerospike/value/value.rb', line 466 def estimate_size # flags + ncells + jsonstr 1 + 2 + @bytes.bytesize end |
#get ⇒ Object
485 486 487 |
# File 'lib/aerospike/value/value.rb', line 485 def get @json end |
#pack(packer) ⇒ Object
477 478 479 |
# File 'lib/aerospike/value/value.rb', line 477 def pack(packer) packer.write(Aerospike::ParticleType::GEOJSON.chr + @bytes) end |
#to_bytes ⇒ Object
489 490 491 |
# File 'lib/aerospike/value/value.rb', line 489 def to_bytes @bytes end |
#to_s ⇒ Object
493 494 495 |
# File 'lib/aerospike/value/value.rb', line 493 def to_s @json end |
#type ⇒ Object
481 482 483 |
# File 'lib/aerospike/value/value.rb', line 481 def type Aerospike::ParticleType::GEOJSON end |
#write(buffer, offset) ⇒ Object
471 472 473 474 475 |
# File 'lib/aerospike/value/value.rb', line 471 def write(buffer, offset) buffer.write_byte(0, offset) # flags buffer.write_uint16(0, offset + 1) # ncells return 1 + 2 + buffer.write_binary(@bytes, offset + 3) # JSON string end |