Skip to content

Commit adc38f8

Browse files
authored
Merge pull request #1151 from ruby/fix-getaddrinfo
Let `peer`/`nodename` be `nil` if `protocol`/`service` is not
2 parents 27cfc6b + 67b5012 commit adc38f8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

stdlib/socket/0/addrinfo.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class Addrinfo
5757
# #=> [#<Addrinfo: 203.178.141.194:80 TCP (www.kame.net)>,
5858
# # #<Addrinfo: [2001:200:dff:fff1:216:3eff:feb1:44d7]:80 TCP (www.kame.net)>]
5959
#
60-
def self.getaddrinfo: (String nodename, ?String | Integer service, ?Symbol? family, ?Symbol | Integer protocol) -> Array[Addrinfo]
60+
def self.getaddrinfo: (String nodename, ?String | Integer | nil service, ?Symbol? family, ?Symbol | Integer protocol) -> Array[Addrinfo]
61+
| (String? nodename, ?String | Integer service, ?Symbol? family, ?Symbol | Integer protocol) -> Array[Addrinfo]
6162

6263
# <!--
6364
# rdoc-file=ext/socket/raddrinfo.c

stdlib/socket/0/socket.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class Socket < BasicSocket
165165
# If Addrinfo object is preferred, use Addrinfo.getaddrinfo.
166166
#
167167
def self.getaddrinfo: (String peer, String | Integer | nil protocol, ?Integer | Symbol | nil family, ?Integer | Symbol | nil socktype, ?Integer | Symbol | nil protocol, ?Integer | nil flags) -> [ String, Integer, String, String, Integer, Integer, Integer ]
168+
| (String? peer, String | Integer protocol, ?Integer | Symbol | nil family, ?Integer | Symbol | nil socktype, ?Integer | Symbol | nil protocol, ?Integer | nil flags) -> [ String, Integer, String, String, Integer, Integer, Integer ]
168169

169170
# <!--
170171
# rdoc-file=ext/socket/socket.c

0 commit comments

Comments
 (0)