module Bones::RPC::Protocol

The Bones::RPC::Protocol namespace contains convenience classes for building all of the possible messages defined in the Bones RPC Protocol.

Constants

MAP

Public Instance Methods

deserialize(buffer, adapter = nil) click to toggle source
# File lib/bones/rpc/protocol.rb, line 42
def deserialize(buffer, adapter = nil)
  char = buffer.getc
  buffer.ungetc(char)
  if sub = MAP[char]
    sub.deserialize(buffer, adapter)
  elsif adapter
    Adapter.get(adapter).deserialize(buffer)
  else
    raise NotImplementedError, "Unknown data received: #{char.inspect}"
  end
end
get_by_ext_head(head) click to toggle source
# File lib/bones/rpc/protocol.rb, line 9
def get_by_ext_head(head)
  ext_heads[head]
end
register_ext_head(message, head) click to toggle source
# File lib/bones/rpc/protocol.rb, line 13
def register_ext_head(message, head)
  ext_heads[head] ||= message
  return message
end

Private Instance Methods

ext_heads() click to toggle source
# File lib/bones/rpc/protocol.rb, line 20
def ext_heads
  @ext_heads ||= {}
end