Class: Aerospike::FloatValue

Inherits:
Value
  • Object
show all
Defined in:
lib/aerospike/value/value.rb

Overview

Float value.

Instance Method Summary collapse

Methods inherited from Value

of, validate_hash_key

Constructor Details

#initialize(val) ⇒ FloatValue

:nodoc:



332
333
334
335
# File 'lib/aerospike/value/value.rb', line 332

def initialize(val)
  @value = val || 0.0
  self
end

Instance Method Details

#estimate_sizeObject



337
338
339
# File 'lib/aerospike/value/value.rb', line 337

def estimate_size
  8
end

#getObject



354
355
356
# File 'lib/aerospike/value/value.rb', line 354

def get
  @value
end

#pack(packer) ⇒ Object



346
347
348
# File 'lib/aerospike/value/value.rb', line 346

def pack(packer)
  packer.write(@value)
end

#to_bytesObject



358
359
360
# File 'lib/aerospike/value/value.rb', line 358

def to_bytes
  [@value].pack("G")
end

#to_sObject



362
363
364
# File 'lib/aerospike/value/value.rb', line 362

def to_s
  @value.to_s
end

#typeObject



350
351
352
# File 'lib/aerospike/value/value.rb', line 350

def type
  Aerospike::ParticleType::DOUBLE
end

#write(buffer, offset) ⇒ Object



341
342
343
344
# File 'lib/aerospike/value/value.rb', line 341

def write(buffer, offset)
  buffer.write_double(@value, offset)
  8
end