Class: Aerospike::Packer

Inherits:
MessagePack::Packer
  • Object
show all
Defined in:
lib/aerospike/utils/packer.rb

Overview

:nodoc:

Constant Summary collapse

AS_EXT_TYPE =
-1
@@pool =
Pool.new

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.useObject



32
33
34
35
36
37
38
# File 'lib/aerospike/utils/packer.rb', line 32

def self.use
  packer = @@pool.poll
  packer.clear
  yield packer
ensure
  @@pool.offer(packer)
end

Instance Method Details

#bytesObject



49
50
51
# File 'lib/aerospike/utils/packer.rb', line 49

def bytes
  self.to_s.force_encoding("binary")
end

#write_raw(buf) ⇒ Object



45
46
47
# File 'lib/aerospike/utils/packer.rb', line 45

def write_raw(buf)
  buffer.write(buf)
end

#write_raw_short(val) ⇒ Object

WARNING: This method is not compatible with message pack standard.



41
42
43
# File 'lib/aerospike/utils/packer.rb', line 41

def write_raw_short(val)
  buffer << [val].pack("S>")
end