rbs 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -0
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +6 -1
  5. data/core/array.rbs +2866 -1086
  6. data/core/basic_object.rbs +150 -30
  7. data/core/binding.rbs +33 -0
  8. data/core/builtin.rbs +4 -4
  9. data/core/class.rbs +43 -5
  10. data/core/comparable.rbs +57 -0
  11. data/core/complex.rbs +170 -4
  12. data/core/constants.rbs +51 -0
  13. data/core/deprecated.rbs +7 -0
  14. data/core/dir.rbs +305 -20
  15. data/core/encoding.rbs +472 -77
  16. data/core/enumerable.rbs +2173 -234
  17. data/core/enumerator.rbs +448 -182
  18. data/core/env.rbs +448 -1
  19. data/core/errno.rbs +1 -10
  20. data/core/errors.rbs +152 -2
  21. data/core/exception.rbs +201 -127
  22. data/core/false_class.rbs +27 -0
  23. data/core/fiber.rbs +118 -37
  24. data/core/fiber_error.rbs +8 -9
  25. data/core/file.rbs +1059 -139
  26. data/core/file_test.rbs +287 -32
  27. data/core/float.rbs +776 -300
  28. data/core/gc.rbs +185 -34
  29. data/core/global_variables.rbs +5 -1
  30. data/core/hash.rbs +1582 -649
  31. data/core/integer.rbs +974 -204
  32. data/core/io/buffer.rbs +710 -0
  33. data/core/io/wait.rbs +29 -8
  34. data/core/io.rbs +2438 -417
  35. data/core/kernel.rbs +2315 -316
  36. data/core/marshal.rbs +37 -2
  37. data/core/match_data.rbs +123 -6
  38. data/core/math.rbs +126 -6
  39. data/core/method.rbs +226 -102
  40. data/core/module.rbs +421 -45
  41. data/core/nil_class.rbs +64 -0
  42. data/core/numeric.rbs +620 -142
  43. data/core/object.rbs +453 -81
  44. data/core/object_space.rbs +92 -2
  45. data/core/proc.rbs +482 -285
  46. data/core/process.rbs +443 -34
  47. data/core/ractor.rbs +232 -9
  48. data/core/random.rbs +151 -52
  49. data/core/range.rbs +885 -160
  50. data/core/rational.rbs +122 -6
  51. data/core/rb_config.rbs +14 -4
  52. data/core/refinement.rbs +44 -0
  53. data/core/regexp.rbs +156 -14
  54. data/core/ruby_vm.rbs +42 -3
  55. data/core/signal.rbs +78 -39
  56. data/core/string.rbs +2123 -567
  57. data/core/string_io.rbs +204 -0
  58. data/core/struct.rbs +283 -28
  59. data/core/symbol.rbs +304 -30
  60. data/core/thread.rbs +1288 -688
  61. data/core/thread_group.rbs +66 -10
  62. data/core/time.rbs +643 -217
  63. data/core/trace_point.rbs +100 -12
  64. data/core/true_class.rbs +24 -0
  65. data/core/unbound_method.rbs +73 -7
  66. data/core/warning.rbs +37 -12
  67. data/docs/CONTRIBUTING.md +40 -34
  68. data/docs/stdlib.md +3 -102
  69. data/lib/rbs/annotate/annotations.rb +197 -0
  70. data/lib/rbs/annotate/formatter.rb +80 -0
  71. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  72. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  73. data/lib/rbs/annotate.rb +6 -0
  74. data/lib/rbs/cli.rb +45 -1
  75. data/lib/rbs/definition_builder.rb +5 -1
  76. data/lib/rbs/location_aux.rb +12 -0
  77. data/lib/rbs/prototype/rb.rb +12 -0
  78. data/lib/rbs/version.rb +1 -1
  79. data/sig/annotate/annotations.rbs +102 -0
  80. data/sig/annotate/formatter.rbs +24 -0
  81. data/sig/annotate/rdoc_annotater.rbs +82 -0
  82. data/sig/annotate/rdoc_source.rbs +30 -0
  83. data/sig/cli.rbs +2 -0
  84. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  85. data/sig/location.rbs +6 -0
  86. data/sig/method_types.rbs +5 -1
  87. data/sig/polyfill.rbs +78 -0
  88. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  89. data/stdlib/abbrev/0/array.rbs +26 -0
  90. data/stdlib/base64/0/base64.rbs +31 -0
  91. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  92. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  93. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  94. data/stdlib/cgi/0/core.rbs +59 -0
  95. data/stdlib/coverage/0/coverage.rbs +164 -2
  96. data/stdlib/csv/0/csv.rbs +2862 -398
  97. data/stdlib/date/0/date.rbs +483 -25
  98. data/stdlib/date/0/date_time.rbs +187 -12
  99. data/stdlib/dbm/0/dbm.rbs +152 -17
  100. data/stdlib/digest/0/digest.rbs +146 -0
  101. data/stdlib/erb/0/erb.rbs +65 -245
  102. data/stdlib/fiber/0/fiber.rbs +73 -91
  103. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  104. data/stdlib/find/0/find.rbs +9 -0
  105. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  106. data/stdlib/io-console/0/io-console.rbs +227 -15
  107. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  108. data/stdlib/json/0/json.rbs +1146 -144
  109. data/stdlib/logger/0/formatter.rbs +24 -0
  110. data/stdlib/logger/0/log_device.rbs +64 -0
  111. data/stdlib/logger/0/logger.rbs +165 -13
  112. data/stdlib/logger/0/period.rbs +10 -0
  113. data/stdlib/logger/0/severity.rbs +26 -0
  114. data/stdlib/monitor/0/monitor.rbs +163 -0
  115. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  116. data/stdlib/net-http/0/net-http.rbs +1492 -683
  117. data/stdlib/nkf/0/nkf.rbs +372 -0
  118. data/stdlib/objspace/0/objspace.rbs +149 -90
  119. data/stdlib/openssl/0/openssl.rbs +8108 -71
  120. data/stdlib/optparse/0/optparse.rbs +487 -19
  121. data/stdlib/pathname/0/pathname.rbs +425 -124
  122. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  123. data/stdlib/prime/0/integer-extension.rbs +20 -2
  124. data/stdlib/prime/0/prime.rbs +88 -21
  125. data/stdlib/pstore/0/pstore.rbs +102 -0
  126. data/stdlib/pty/0/pty.rbs +64 -14
  127. data/stdlib/resolv/0/resolv.rbs +420 -31
  128. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  129. data/stdlib/rubygems/0/config_file.rbs +33 -1
  130. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  131. data/stdlib/rubygems/0/installer.rbs +13 -1
  132. data/stdlib/rubygems/0/path_support.rbs +4 -1
  133. data/stdlib/rubygems/0/platform.rbs +5 -1
  134. data/stdlib/rubygems/0/request_set.rbs +44 -2
  135. data/stdlib/rubygems/0/requirement.rbs +65 -2
  136. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  137. data/stdlib/rubygems/0/source_list.rbs +13 -0
  138. data/stdlib/rubygems/0/specification.rbs +21 -1
  139. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  140. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  141. data/stdlib/rubygems/0/version.rbs +60 -157
  142. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  143. data/stdlib/set/0/set.rbs +420 -106
  144. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  145. data/stdlib/singleton/0/singleton.rbs +20 -0
  146. data/stdlib/socket/0/addrinfo.rbs +210 -9
  147. data/stdlib/socket/0/basic_socket.rbs +103 -11
  148. data/stdlib/socket/0/ip_socket.rbs +31 -9
  149. data/stdlib/socket/0/socket.rbs +586 -38
  150. data/stdlib/socket/0/tcp_server.rbs +22 -2
  151. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  152. data/stdlib/socket/0/udp_socket.rbs +25 -2
  153. data/stdlib/socket/0/unix_server.rbs +22 -2
  154. data/stdlib/socket/0/unix_socket.rbs +45 -5
  155. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  156. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  157. data/stdlib/time/0/time.rbs +208 -116
  158. data/stdlib/timeout/0/timeout.rbs +10 -0
  159. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  160. data/stdlib/tsort/0/cyclic.rbs +1 -0
  161. data/stdlib/tsort/0/interfaces.rbs +1 -0
  162. data/stdlib/tsort/0/tsort.rbs +42 -0
  163. data/stdlib/uri/0/common.rbs +57 -8
  164. data/stdlib/uri/0/file.rbs +55 -109
  165. data/stdlib/uri/0/ftp.rbs +6 -3
  166. data/stdlib/uri/0/generic.rbs +556 -327
  167. data/stdlib/uri/0/http.rbs +26 -115
  168. data/stdlib/uri/0/https.rbs +8 -102
  169. data/stdlib/uri/0/ldap.rbs +143 -137
  170. data/stdlib/uri/0/ldaps.rbs +8 -102
  171. data/stdlib/uri/0/mailto.rbs +3 -0
  172. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  173. data/stdlib/uri/0/ws.rbs +6 -3
  174. data/stdlib/uri/0/wss.rbs +5 -3
  175. data/stdlib/yaml/0/dbm.rbs +151 -87
  176. data/stdlib/yaml/0/store.rbs +6 -0
  177. data/stdlib/zlib/0/zlib.rbs +90 -31
  178. metadata +17 -5
  179. data/lib/rbs/location.rb +0 -221
@@ -1,11 +1,21 @@
1
+ # <!-- rdoc-file=ext/socket/basicsocket.c -->
1
2
  # BasicSocket is the super class for all the Socket classes.
3
+ #
2
4
  class BasicSocket < IO
5
+ # <!--
6
+ # rdoc-file=ext/socket/basicsocket.c
7
+ # - BasicSocket.do_not_reverse_lookup => true or false
8
+ # -->
3
9
  # Gets the global do_not_reverse_lookup flag.
4
10
  #
5
11
  # BasicSocket.do_not_reverse_lookup #=> false
6
12
  #
7
13
  def self.do_not_reverse_lookup: () -> bool
8
14
 
15
+ # <!--
16
+ # rdoc-file=ext/socket/basicsocket.c
17
+ # - BasicSocket.do_not_reverse_lookup = bool
18
+ # -->
9
19
  # Sets the global do_not_reverse_lookup flag.
10
20
  #
11
21
  # The flag is used for initial value of do_not_reverse_lookup for each socket.
@@ -19,6 +29,10 @@ class BasicSocket < IO
19
29
  #
20
30
  def self.do_not_reverse_lookup=: (boolish) -> void
21
31
 
32
+ # <!--
33
+ # rdoc-file=ext/socket/basicsocket.c
34
+ # - BasicSocket.for_fd(fd) => basicsocket
35
+ # -->
22
36
  # Returns a socket object which contains the file descriptor, *fd*.
23
37
  #
24
38
  # # If invoked by inetd, STDIN/STDOUT/STDERR is a socket.
@@ -29,6 +43,10 @@ class BasicSocket < IO
29
43
 
30
44
  public
31
45
 
46
+ # <!--
47
+ # rdoc-file=ext/socket/basicsocket.c
48
+ # - basicsocket.close_read => nil
49
+ # -->
32
50
  # Disallows further read using shutdown system call.
33
51
  #
34
52
  # s1, s2 = UNIXSocket.pair
@@ -37,6 +55,10 @@ class BasicSocket < IO
37
55
  #
38
56
  def close_read: () -> void
39
57
 
58
+ # <!--
59
+ # rdoc-file=ext/socket/basicsocket.c
60
+ # - basicsocket.close_write => nil
61
+ # -->
40
62
  # Disallows further write using shutdown system call.
41
63
  #
42
64
  # UNIXSocket.pair {|s1, s2|
@@ -50,6 +72,10 @@ class BasicSocket < IO
50
72
  #
51
73
  def close_write: () -> void
52
74
 
75
+ # <!--
76
+ # rdoc-file=ext/socket/lib/socket.rb
77
+ # - connect_address()
78
+ # -->
53
79
  # Returns an address of the socket suitable for connect in the local machine.
54
80
  #
55
81
  # This method returns *self*.local_address, except following condition.
@@ -73,6 +99,10 @@ class BasicSocket < IO
73
99
  #
74
100
  def connect_address: () -> Addrinfo
75
101
 
102
+ # <!--
103
+ # rdoc-file=ext/socket/basicsocket.c
104
+ # - basicsocket.do_not_reverse_lookup => true or false
105
+ # -->
76
106
  # Gets the do_not_reverse_lookup flag of *basicsocket*.
77
107
  #
78
108
  # require 'socket'
@@ -88,6 +118,10 @@ class BasicSocket < IO
88
118
  #
89
119
  def do_not_reverse_lookup: () -> bool
90
120
 
121
+ # <!--
122
+ # rdoc-file=ext/socket/basicsocket.c
123
+ # - basicsocket.do_not_reverse_lookup = bool
124
+ # -->
91
125
  # Sets the do_not_reverse_lookup flag of *basicsocket*.
92
126
  #
93
127
  # TCPSocket.open("www.ruby-lang.org", 80) {|sock|
@@ -99,6 +133,10 @@ class BasicSocket < IO
99
133
  #
100
134
  def do_not_reverse_lookup=: (boolish) -> void
101
135
 
136
+ # <!--
137
+ # rdoc-file=ext/socket/basicsocket.c
138
+ # - basicsocket.getpeereid => [euid, egid]
139
+ # -->
102
140
  # Returns the user and group on the peer of the UNIX socket. The result is a two
103
141
  # element array which contains the effective uid and the effective gid.
104
142
  #
@@ -116,8 +154,12 @@ class BasicSocket < IO
116
154
  # end
117
155
  # }
118
156
  #
119
- def getpeereid: () -> [Integer, Integer]
157
+ def getpeereid: () -> [ Integer, Integer ]
120
158
 
159
+ # <!--
160
+ # rdoc-file=ext/socket/basicsocket.c
161
+ # - basicsocket.getpeername => sockaddr
162
+ # -->
121
163
  # Returns the remote address of the socket as a sockaddr string.
122
164
  #
123
165
  # TCPServer.open("127.0.0.1", 1440) {|serv|
@@ -131,6 +173,10 @@ class BasicSocket < IO
131
173
  #
132
174
  def getpeername: () -> String
133
175
 
176
+ # <!--
177
+ # rdoc-file=ext/socket/basicsocket.c
178
+ # - basicsocket.getsockname => sockaddr
179
+ # -->
134
180
  # Returns the local address of the socket as a sockaddr string.
135
181
  #
136
182
  # TCPServer.open("127.0.0.1", 15120) {|serv|
@@ -142,6 +188,10 @@ class BasicSocket < IO
142
188
  #
143
189
  def getsockname: () -> String
144
190
 
191
+ # <!--
192
+ # rdoc-file=ext/socket/basicsocket.c
193
+ # - getsockopt(level, optname) => socketoption
194
+ # -->
145
195
  # Gets a socket option. These are protocol and system specific, see your local
146
196
  # system documentation for details. The option is returned as a Socket::Option
147
197
  # object.
@@ -172,7 +222,7 @@ class BasicSocket < IO
172
222
  # ipttl = sock.getsockopt(:IP, :TTL).int
173
223
  #
174
224
  # optval = sock.getsockopt(Socket::IPPROTO_IP, Socket::IP_TTL)
175
- # ipttl = optval.unpack("i")[0]
225
+ # ipttl = optval.unpack1("i")
176
226
  #
177
227
  # Option values may be structs. Decoding them can be complex as it involves
178
228
  # examining your system headers to determine the correct definition. An example
@@ -193,6 +243,10 @@ class BasicSocket < IO
193
243
  #
194
244
  def getsockopt: (Symbol | Integer, Symbol | Integer) -> (Integer | boolish | String)
195
245
 
246
+ # <!--
247
+ # rdoc-file=ext/socket/basicsocket.c
248
+ # - bsock.local_address => addrinfo
249
+ # -->
196
250
  # Returns an Addrinfo object for local address obtained by getsockname.
197
251
  #
198
252
  # Note that addrinfo.protocol is filled by 0.
@@ -207,6 +261,10 @@ class BasicSocket < IO
207
261
  #
208
262
  def local_address: () -> Addrinfo
209
263
 
264
+ # <!--
265
+ # rdoc-file=ext/socket/basicsocket.c
266
+ # - basicsocket.recv(maxlen[, flags[, outbuf]]) => mesg
267
+ # -->
210
268
  # Receives a message.
211
269
  #
212
270
  # *maxlen* is the maximum number of bytes to receive.
@@ -227,6 +285,10 @@ class BasicSocket < IO
227
285
  def recv: (Integer maxlen, ?Integer flags, ?String outbuf) -> String
228
286
  | (Integer maxlen, ?String outbuf) -> String
229
287
 
288
+ # <!--
289
+ # rdoc-file=ext/socket/lib/socket.rb
290
+ # - basicsocket.recv_nonblock(maxlen [, flags [, buf [, options ]]]) => mesg
291
+ # -->
230
292
  # Receives up to *maxlen* bytes from `socket` using recvfrom(2) after O_NONBLOCK
231
293
  # is set for the underlying file descriptor. *flags* is zero or more of the
232
294
  # `MSG_` options. The result, *mesg*, is the data received.
@@ -271,9 +333,12 @@ class BasicSocket < IO
271
333
  # ### See
272
334
  # * Socket#recvfrom
273
335
  #
274
- #
275
336
  def recv_nonblock: (Integer maxlen, ?Integer flags, ?String buf, ?exception: boolish) -> (String | :wait_readable)
276
337
 
338
+ # <!--
339
+ # rdoc-file=ext/socket/lib/socket.rb
340
+ # - basicsocket.recvmsg(maxmesglen=nil, flags=0, maxcontrollen=nil, opts={}) => [mesg, sender_addrinfo, rflags, *controls]
341
+ # -->
277
342
  # recvmsg receives a message using recvmsg(2) system call in blocking manner.
278
343
  #
279
344
  # *maxmesglen* is the maximum length of mesg to receive.
@@ -323,8 +388,12 @@ class BasicSocket < IO
323
388
  # end
324
389
  # }
325
390
  #
326
- def recvmsg: (?Integer dlen, ?Integer flags, ?Integer clen, ?scm_rights: boolish) -> [String, Addrinfo, Integer?, Array[Socket::AncillaryData]]
391
+ def recvmsg: (?Integer dlen, ?Integer flags, ?Integer clen, ?scm_rights: boolish) -> [ String, Addrinfo, Integer?, Array[Socket::AncillaryData] ]
327
392
 
393
+ # <!--
394
+ # rdoc-file=ext/socket/lib/socket.rb
395
+ # - basicsocket.recvmsg_nonblock(maxdatalen=nil, flags=0, maxcontrollen=nil, opts={}) => [data, sender_addrinfo, rflags, *controls]
396
+ # -->
328
397
  # recvmsg receives a message using recvmsg(2) system call in non-blocking
329
398
  # manner.
330
399
  #
@@ -335,8 +404,12 @@ class BasicSocket < IO
335
404
  # recvmsg_nonblock should not raise an IO::WaitReadable exception, but return
336
405
  # the symbol `:wait_readable` instead.
337
406
  #
338
- def recvmsg_nonblock: (?Integer dlen, ?Integer flags, ?Integer clen, ?exception: boolish, ?scm_rights: boolish) -> ([String, Addrinfo, Integer?, Array[Socket::AncillaryData]] | :wait_readable)
407
+ def recvmsg_nonblock: (?Integer dlen, ?Integer flags, ?Integer clen, ?exception: boolish, ?scm_rights: boolish) -> ([ String, Addrinfo, Integer?, Array[Socket::AncillaryData] ] | :wait_readable)
339
408
 
409
+ # <!--
410
+ # rdoc-file=ext/socket/basicsocket.c
411
+ # - bsock.remote_address => addrinfo
412
+ # -->
340
413
  # Returns an Addrinfo object for remote address obtained by getpeername.
341
414
  #
342
415
  # Note that addrinfo.protocol is filled by 0.
@@ -353,6 +426,10 @@ class BasicSocket < IO
353
426
  #
354
427
  def remote_address: () -> Addrinfo
355
428
 
429
+ # <!--
430
+ # rdoc-file=ext/socket/basicsocket.c
431
+ # - basicsocket.send(mesg, flags [, dest_sockaddr]) => numbytes_sent
432
+ # -->
356
433
  # send *mesg* via *basicsocket*.
357
434
  #
358
435
  # *mesg* should be a string.
@@ -366,8 +443,12 @@ class BasicSocket < IO
366
443
  # p s.read
367
444
  # }
368
445
  #
369
- def send: (String msg, ?Integer flags, ?(Addrinfo | String) dest_sockaddr) -> void
446
+ def send: (String msg, ?Integer flags, ?Addrinfo | String dest_sockaddr) -> void
370
447
 
448
+ # <!--
449
+ # rdoc-file=ext/socket/lib/socket.rb
450
+ # - basicsocket.sendmsg(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent
451
+ # -->
371
452
  # sendmsg sends a message using sendmsg(2) system call in blocking manner.
372
453
  #
373
454
  # *mesg* is a string to send.
@@ -395,8 +476,12 @@ class BasicSocket < IO
395
476
  # ancdata = [:SOCKET, :RIGHTS, [io.fileno].pack("i!")]
396
477
  # sock.sendmsg("\0", 0, nil, ancdata)
397
478
  #
398
- def sendmsg: (String mesg, ?Integer flags, ?(Addrinfo | String) dest_sockaddr, *Socket::AncillaryData controls) -> Integer
479
+ def sendmsg: (String mesg, ?Integer flags, ?Addrinfo | String dest_sockaddr, *Socket::AncillaryData controls) -> Integer
399
480
 
481
+ # <!--
482
+ # rdoc-file=ext/socket/lib/socket.rb
483
+ # - basicsocket.sendmsg_nonblock(mesg, flags=0, dest_sockaddr=nil, *controls, opts={}) => numbytes_sent
484
+ # -->
400
485
  # sendmsg_nonblock sends a message using sendmsg(2) system call in non-blocking
401
486
  # manner.
402
487
  #
@@ -407,8 +492,13 @@ class BasicSocket < IO
407
492
  # sendmsg_nonblock should not raise an IO::WaitWritable exception, but return
408
493
  # the symbol `:wait_writable` instead.
409
494
  #
410
- def sendmsg_nonblock: (String mesg, ?Integer flags, ?(Addrinfo | String) dest_sockaddr, *Socket::AncillaryData controls, ?exception: boolish) -> (Integer | :wait_writable)
495
+ def sendmsg_nonblock: (String mesg, ?Integer flags, ?Addrinfo | String dest_sockaddr, *Socket::AncillaryData controls, ?exception: boolish) -> (Integer | :wait_writable)
411
496
 
497
+ # <!--
498
+ # rdoc-file=ext/socket/basicsocket.c
499
+ # - setsockopt(level, optname, optval)
500
+ # - setsockopt(socketoption)
501
+ # -->
412
502
  # Sets a socket option. These are protocol and system specific, see your local
413
503
  # system documentation for details.
414
504
  #
@@ -459,9 +549,12 @@ class BasicSocket < IO
459
549
  # IPAddr.new(Socket::INADDR_ANY, Socket::AF_INET).hton
460
550
  # sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, optval)
461
551
  #
462
- #
463
- def setsockopt: (*(Symbol | Integer), boolish | Integer | String) -> void
552
+ def setsockopt: (*Symbol | Integer, boolish | Integer | String) -> void
464
553
 
554
+ # <!--
555
+ # rdoc-file=ext/socket/basicsocket.c
556
+ # - basicsocket.shutdown([how]) => 0
557
+ # -->
465
558
  # Calls shutdown(2) system call.
466
559
  #
467
560
  # s.shutdown(Socket::SHUT_RD) disallows further read.
@@ -486,7 +579,6 @@ class BasicSocket < IO
486
579
  #
487
580
  # }
488
581
  #
489
- #
490
582
  def shutdown: (Symbol | String | Integer flags) -> void
491
583
 
492
584
  private
@@ -1,5 +1,11 @@
1
+ # <!-- rdoc-file=ext/socket/ipsocket.c -->
1
2
  # IPSocket is the super class of TCPSocket and UDPSocket.
3
+ #
2
4
  class IPSocket < BasicSocket
5
+ # <!--
6
+ # rdoc-file=ext/socket/ipsocket.c
7
+ # - IPSocket.getaddress(host) => ipaddress
8
+ # -->
3
9
  # Lookups the IP address of *host*.
4
10
  #
5
11
  # require 'socket'
@@ -11,13 +17,17 @@ class IPSocket < BasicSocket
11
17
 
12
18
  public
13
19
 
20
+ # <!--
21
+ # rdoc-file=ext/socket/ipsocket.c
22
+ # - ipsocket.addr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
23
+ # -->
14
24
  # Returns the local address as an array which contains address_family, port,
15
25
  # hostname and numeric_address.
16
26
  #
17
27
  # If `reverse_lookup` is `true` or `:hostname`, hostname is obtained from
18
28
  # numeric_address using reverse lookup. Or if it is `false`, or `:numeric`,
19
- # hostname is same as numeric_address. Or if it is `nil` or omitted, obeys to
20
- # `ipsocket.do_not_reverse_lookup`. See `Socket.getaddrinfo` also.
29
+ # hostname is the same as numeric_address. Or if it is `nil` or omitted, obeys
30
+ # to `ipsocket.do_not_reverse_lookup`. See `Socket.getaddrinfo` also.
21
31
  #
22
32
  # TCPSocket.open("www.ruby-lang.org", 80) {|sock|
23
33
  # p sock.addr #=> ["AF_INET", 49429, "hal", "192.168.0.128"]
@@ -27,20 +37,28 @@ class IPSocket < BasicSocket
27
37
  # p sock.addr(:numeric) #=> ["AF_INET", 49429, "192.168.0.128", "192.168.0.128"]
28
38
  # }
29
39
  #
30
- def addr: (?(boolish | :hostname | :numeric) reverse_lookup) -> [String, Integer, String, String]
40
+ def addr: (?boolish | :hostname | :numeric reverse_lookup) -> [ String, Integer, String, String ]
31
41
 
42
+ # <!--
43
+ # rdoc-file=ext/socket/ipsocket.c
44
+ # - ipsocket.inspect -> string
45
+ # -->
32
46
  # Return a string describing this IPSocket object.
33
47
  #
34
48
  def inspect: () -> String
35
49
 
50
+ # <!--
51
+ # rdoc-file=ext/socket/ipsocket.c
52
+ # - ipsocket.peeraddr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
53
+ # -->
36
54
  # Returns the remote address as an array which contains address_family, port,
37
55
  # hostname and numeric_address. It is defined for connection oriented socket
38
56
  # such as TCPSocket.
39
57
  #
40
58
  # If `reverse_lookup` is `true` or `:hostname`, hostname is obtained from
41
59
  # numeric_address using reverse lookup. Or if it is `false`, or `:numeric`,
42
- # hostname is same as numeric_address. Or if it is `nil` or omitted, obeys to
43
- # `ipsocket.do_not_reverse_lookup`. See `Socket.getaddrinfo` also.
60
+ # hostname is the same as numeric_address. Or if it is `nil` or omitted, obeys
61
+ # to `ipsocket.do_not_reverse_lookup`. See `Socket.getaddrinfo` also.
44
62
  #
45
63
  # TCPSocket.open("www.ruby-lang.org", 80) {|sock|
46
64
  # p sock.peeraddr #=> ["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68"]
@@ -50,8 +68,13 @@ class IPSocket < BasicSocket
50
68
  # p sock.peeraddr(:numeric) #=> ["AF_INET", 80, "221.186.184.68", "221.186.184.68"]
51
69
  # }
52
70
  #
53
- def peeraddr: (?(boolish | :hostname | :numeric) reverse_lookup) -> [String, Integer, String, String]
71
+ def peeraddr: (?boolish | :hostname | :numeric reverse_lookup) -> [ String, Integer, String, String ]
54
72
 
73
+ # <!--
74
+ # rdoc-file=ext/socket/ipsocket.c
75
+ # - ipsocket.recvfrom(maxlen) => [mesg, ipaddr]
76
+ # - ipsocket.recvfrom(maxlen, flags) => [mesg, ipaddr]
77
+ # -->
55
78
  # Receives a message and return the message as a string and an address which the
56
79
  # message come from.
57
80
  #
@@ -59,7 +82,7 @@ class IPSocket < BasicSocket
59
82
  #
60
83
  # *flags* should be a bitwise OR of Socket::MSG_* constants.
61
84
  #
62
- # ipaddr is same as IPSocket#{peeraddr,addr}.
85
+ # ipaddr is the same as IPSocket#{peeraddr,addr}.
63
86
  #
64
87
  # u1 = UDPSocket.new
65
88
  # u1.bind("127.0.0.1", 4913)
@@ -67,6 +90,5 @@ class IPSocket < BasicSocket
67
90
  # u2.send "uuuu", 0, "127.0.0.1", 4913
68
91
  # p u1.recvfrom(10) #=> ["uuuu", ["AF_INET", 33230, "localhost", "127.0.0.1"]]
69
92
  #
70
- #
71
- def recvfrom: (Integer maxlen, ?Integer flags) -> [String, [String, Integer, String, String]]
93
+ def recvfrom: (Integer maxlen, ?Integer flags) -> [ String, [ String, Integer, String, String ] ]
72
94
  end