Skip to content

Commit 674da27

Browse files
committed
Improved documentation for Protocol::HTTP::Peer.
1 parent 3334796 commit 674da27

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/protocol/http/peer.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ module Protocol
77
module HTTP
88
# Provide a well defined, cached representation of a peer (address).
99
class Peer
10+
# Create a new peer object for the given IO object, using the remote address if available.
11+
#
12+
# @returns [Peer | Nil] The peer object, or nil if the remote address is not available.
1013
def self.for(io)
1114
if address = io.remote_address
1215
return new(address)
1316
end
1417
end
1518

19+
# Initialize the peer with the given address.
20+
#
21+
# @parameter address [Addrinfo] The remote address of the peer.
1622
def initialize(address)
1723
@address = address
1824

@@ -21,7 +27,10 @@ def initialize(address)
2127
end
2228
end
2329

30+
# @attribute [Addrinfo] The remote address of the peer.
2431
attr :address
32+
33+
# @attribute [String] The IP address of the peer, if available.
2534
attr :ip_address
2635

2736
alias remote_address address

0 commit comments

Comments
 (0)