Skip to content

Commit a1812d6

Browse files
100% documentation coverage.
1 parent 478e027 commit a1812d6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/async/bus/protocol/wrapper.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,24 @@ def unpack_exception(unpacker)
136136
return exception
137137
end
138138

139+
# Pack a reference type object (e.g., Controller) into a MessagePack packer.
140+
#
141+
# Serializes the object as a proxy by generating a temporary name and writing it to the packer.
142+
# The object is implicitly bound to the connection with a temporary name.
143+
#
144+
# @parameter object [Object] The reference type object to serialize.
145+
# @parameter packer [MessagePack::Packer] The packer to write to.
139146
def pack_reference(object, packer)
140147
packer.write(@connection.proxy_name(object))
141148
end
142149

150+
# Unpack a reference type object from a MessagePack unpacker.
151+
#
152+
# Reads a proxy name and returns the corresponding object or proxy.
153+
# If the object is bound locally, returns the actual object; otherwise returns a proxy.
154+
#
155+
# @parameter unpacker [MessagePack::Unpacker] The unpacker to read from.
156+
# @returns [Object | Proxy] The actual object if bound locally, or a proxy otherwise.
143157
def unpack_reference(unpacker)
144158
@connection.proxy_object(unpacker.read)
145159
end

0 commit comments

Comments
 (0)