Class: Aerospike::GeoJSONValue
- Defined in:
- lib/aerospike/value/value.rb
Overview
GeoJSON value. Supported by Aerospike server version 3.7 and later.
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:
377 378 379 380 381 |
# File 'lib/aerospike/value/value.rb', line 377 def initialize(json) @json = json @bytes = json.to_json self end |
Instance Method Details
#estimate_size ⇒ Object
383 384 385 386 |
# File 'lib/aerospike/value/value.rb', line 383 def estimate_size # flags + ncells + jsonstr 1 + 2 + @bytes.bytesize end |
#get ⇒ Object
402 403 404 |
# File 'lib/aerospike/value/value.rb', line 402 def get @json end |
#pack(packer) ⇒ Object
394 395 396 |
# File 'lib/aerospike/value/value.rb', line 394 def pack(packer) packer.write(Aerospike::ParticleType::GEOJSON.chr + @bytes) end |
#to_bytes ⇒ Object
406 407 408 |
# File 'lib/aerospike/value/value.rb', line 406 def to_bytes @bytes end |
#to_s ⇒ Object
410 411 412 |
# File 'lib/aerospike/value/value.rb', line 410 def to_s @json end |
#type ⇒ Object
398 399 400 |
# File 'lib/aerospike/value/value.rb', line 398 def type Aerospike::ParticleType::GEOJSON end |
#write(buffer, offset) ⇒ Object
388 389 390 391 392 |
# File 'lib/aerospike/value/value.rb', line 388 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 |