Add minor missing doc

bug/bundler_fix
Jon Hart 2014-11-25 07:37:49 -08:00
parent bedf7ed44b
commit c0dab54925
No known key found for this signature in database
GPG Key ID: 2FA9F0A3AFA8E9D3
2 changed files with 10 additions and 0 deletions

View File

@ -52,10 +52,17 @@ module Kademlia
Message.new(type, data[2, data.length]) Message.new(type, data[2, data.length])
end end
# Get this Message as a String
#
# @return [String] the string representation of this Message
def to_str def to_str
[STANDARD_PACKET, @type].pack('CC') + @body [STANDARD_PACKET, @type].pack('CC') + @body
end end
# Compares this Message and another Message for equality
#
# @param other [Message] the Message to compare
# @return [Boolean] true iff the two messages have equal types and bodies, false otherwise
def ==(other) def ==(other)
type == other.type && body == other.body type == other.type && body == other.body
end end

View File

@ -29,6 +29,9 @@ module Kademlia
Pong.new(message.body.unpack('v')[0]) Pong.new(message.body.unpack('v')[0])
end end
# Get this Pong as a String
#
# @return [String] the string representation of this Pong
def to_str def to_str
super + [@port].pack('v') super + [@port].pack('v')
end end