Async::BusSourceAsyncBusProtocolResponse

class Response

Represents a response message from a remote procedure call.

Definitions

def initialize(id, result)

Initialize a new response message.

Signature

parameter id Integer

The transaction ID.

parameter result Object

The result value.

Implementation

def initialize(id, result)
	@id = id
	@result = result
end

attr :id

Signature

attribute Integer

The transaction ID.

attr :result

Signature

attribute Object

The result value.

def pack(packer)

Pack the response into a MessagePack packer.

Signature

parameter packer MessagePack::Packer

The packer to write to.

Implementation

def pack(packer)
	packer.write(@id)
	packer.write(@result)
end

def self.unpack(unpacker)

Unpack a response from a MessagePack unpacker.

Signature

parameter unpacker MessagePack::Unpacker

The unpacker to read from.

returns Response

A new response instance.

Implementation

def self.unpack(unpacker)
	id = unpacker.read
	result = unpacker.read
	
	return self.new(id, result)
end