From: "JWuttke (Joachim Wuttke)" <j.wuttke@...>
Date: 2012-07-14T16:15:59+09:00
Subject: [ruby-core:46429] [ruby-trunk - Bug #6732][Open] documentation error in IPSocket#peeraddr


Issue #6732 has been reported by JWuttke (Joachim Wuttke).

----------------------------------------
Bug #6732: documentation error in IPSocket#peeraddr
https://bugs.ruby-lang.org/issues/6732

Author: JWuttke (Joachim Wuttke)
Status: Open
Priority: Normal
Assignee: 
Category: DOC
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


ri1.9.3 IPSocket#peeraddr
says
  TCPSocket.open("www.ruby-lang.org", 80) {|sock|
    p sock.peeraddr #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
    p sock.peeraddr(true)  #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
    p sock.peeraddr(false) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
    p sock.peeraddr(:hostname) #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
    p sock.peeraddr(:numeric)  #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
  }
the third line is wrong: peeraddr(true) actually returns the same as peeraddr(:hostname)


-- 
http://bugs.ruby-lang.org/