Module: Bones::RPC::Protocol::AdapterHelper

Included in:
Notify, Request, Response
Defined in:
lib/bones/rpc/protocol/adapter_helper.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Extends the including class with ClassMethods.

Parameters:

  • subclass (Class)

    the inheriting class



41
42
43
44
# File 'lib/bones/rpc/protocol/adapter_helper.rb', line 41

def included(base)
  super
  base.extend(ClassMethods)
end

Instance Method Details

#receive_replies(connection) ⇒ nil

Default implementation for a message is to do nothing when receiving replies.

Examples:

Receive replies.

message.receive_replies(connection)

Parameters:

Returns:

  • (nil)

    nil.

Since:

  • 1.0.0



19
# File 'lib/bones/rpc/protocol/adapter_helper.rb', line 19

def receive_replies(connection); end

#serialize(buffer, adapter) ⇒ String

Serializes the message and all of its fields to a new buffer or to the provided buffer.

Examples:

Serliaze the message.

message.serialize

Parameters:

  • buffer (String)

    A buffer to serialize to.

Returns:

  • (String)

    The result of serliazing this message

Since:

  • 1.0.0



32
33
34
# File 'lib/bones/rpc/protocol/adapter_helper.rb', line 32

def serialize(buffer, adapter)
  Adapter.get(adapter).serialize(process, buffer)
end