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:
485 486 487 488 489 |
# File 'lib/aerospike/value/value.rb', line 485 def initialize(json) @json = json @bytes = json.to_json self end |
Instance Method Details
#estimate_size ⇒ Object
491 492 493 494 |
# File 'lib/aerospike/value/value.rb', line 491 def estimate_size # flags + ncells + jsonstr 1 + 2 + @bytes.bytesize end |
#get ⇒ Object
510 511 512 |
# File 'lib/aerospike/value/value.rb', line 510 def get @json end |
#pack(packer) ⇒ Object
502 503 504 |
# File 'lib/aerospike/value/value.rb', line 502 def pack(packer) packer.write(Aerospike::ParticleType::GEOJSON.chr + @bytes) end |
#to_bytes ⇒ Object
514 515 516 |
# File 'lib/aerospike/value/value.rb', line 514 def to_bytes @bytes end |
#to_s ⇒ Object
518 519 520 |
# File 'lib/aerospike/value/value.rb', line 518 def to_s @json end |
#type ⇒ Object
506 507 508 |
# File 'lib/aerospike/value/value.rb', line 506 def type Aerospike::ParticleType::GEOJSON end |
#write(buffer, offset) ⇒ Object
496 497 498 499 500 |
# File 'lib/aerospike/value/value.rb', line 496 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 |