Module: Bones::RPC::Protocol::MessagePackExtended

Extended by:
MessagePackExtended
Included in:
MessagePackExtended
Defined in:
lib/bones/rpc/protocol.rb

Defined Under Namespace

Modules: BonesRPC

Constant Summary collapse

MAP =
{
  [0x0d].pack('C').freeze => BonesRPC
}.freeze

Instance Method Summary collapse

Instance Method Details

#deserialize(buffer, adapter = nil) ⇒ Object


57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/bones/rpc/protocol.rb', line 57

def deserialize(buffer, adapter = nil)
  ext8 = buffer.getc
  len = buffer.getc
  type = buffer.getc
  buffer.ungetc(type)
  buffer.ungetc(len)
  buffer.ungetc(ext8)
  if sub = MAP[type]
    sub.deserialize(buffer, adapter)
  else
    raise NotImplementedError, "Unknown MessagePackExtended data received: {ext8: #{ext8.inspect}, len: #{len.inspect}, type: #{type.inspect}}"
  end
end