class Response
Represents a response message from a remote procedure call.
Definitions
def initialize(id, result)
Initialize a new response message.
Signature
-
parameter
idInteger The transaction ID.
-
parameter
resultObject 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
packerMessagePack::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
unpackerMessagePack::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