rbs 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +23 -0
- data/README.md +6 -1
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +472 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1059 -139
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2315 -316
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/cli.rb +45 -1
- data/lib/rbs/definition_builder.rb +5 -1
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +59 -0
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1146 -144
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/net-http.rbs +1492 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +420 -106
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +556 -327
- data/stdlib/uri/0/http.rbs +26 -115
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +17 -5
- data/lib/rbs/location.rb +0 -221
@@ -1,4 +1,8 @@
|
|
1
1
|
class Addrinfo
|
2
|
+
# <!--
|
3
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
4
|
+
# - foreach(nodename, service, family=nil, socktype=nil, protocol=nil, flags=nil, timeout: nil, &block)
|
5
|
+
# -->
|
2
6
|
# iterates over the list of Addrinfo objects obtained by Addrinfo.getaddrinfo.
|
3
7
|
#
|
4
8
|
# Addrinfo.foreach(nil, 80) {|x| p x }
|
@@ -7,10 +11,18 @@ class Addrinfo
|
|
7
11
|
# # #<Addrinfo: [::1]:80 TCP (:80)>
|
8
12
|
# # #<Addrinfo: [::1]:80 UDP (:80)>
|
9
13
|
#
|
10
|
-
def self.foreach: (String? nodename, String | Integer service, ?Integer? family, ?Symbol socktype, ?
|
11
|
-
|(String? nodename, String | Integer service, ?Integer? family, ?Symbol socktype, ?
|
14
|
+
def self.foreach: (String? nodename, String | Integer service, ?Integer? family, ?Symbol socktype, ?Symbol | Integer protocol, ?Integer flags, ?timeout: Numeric) { (Addrinfo) -> void } -> void
|
15
|
+
| (String? nodename, String | Integer service, ?Integer? family, ?Symbol socktype, ?Symbol | Integer protocol, ?Integer flags, ?timeout: Numeric) -> Enumerable[Addrinfo]
|
12
16
|
|
13
|
-
|
17
|
+
# <!--
|
18
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
19
|
+
# - Addrinfo.getaddrinfo(nodename, service, family, socktype, protocol, flags) => [addrinfo, ...]
|
20
|
+
# - Addrinfo.getaddrinfo(nodename, service, family, socktype, protocol) => [addrinfo, ...]
|
21
|
+
# - Addrinfo.getaddrinfo(nodename, service, family, socktype) => [addrinfo, ...]
|
22
|
+
# - Addrinfo.getaddrinfo(nodename, service, family) => [addrinfo, ...]
|
23
|
+
# - Addrinfo.getaddrinfo(nodename, service) => [addrinfo, ...]
|
24
|
+
# -->
|
25
|
+
# returns a list of addrinfo objects as an array.
|
14
26
|
#
|
15
27
|
# This method converts nodename (hostname) and service (port) to addrinfo. Since
|
16
28
|
# the conversion is not unique, the result is a list of addrinfo objects.
|
@@ -45,8 +57,12 @@ class Addrinfo
|
|
45
57
|
# #=> [#<Addrinfo: 203.178.141.194:80 TCP (www.kame.net)>,
|
46
58
|
# # #<Addrinfo: [2001:200:dff:fff1:216:3eff:feb1:44d7]:80 TCP (www.kame.net)>]
|
47
59
|
#
|
48
|
-
def self.getaddrinfo: (String nodename, ?
|
60
|
+
def self.getaddrinfo: (String nodename, ?String | Integer service, ?Symbol? family, ?Symbol | Integer protocol) -> Array[Addrinfo]
|
49
61
|
|
62
|
+
# <!--
|
63
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
64
|
+
# - Addrinfo.ip(host) => addrinfo
|
65
|
+
# -->
|
50
66
|
# returns an addrinfo object for IP address.
|
51
67
|
#
|
52
68
|
# The port, socktype, protocol of the result is filled by zero. So, it is not
|
@@ -56,18 +72,30 @@ class Addrinfo
|
|
56
72
|
#
|
57
73
|
def self.ip: (String host) -> Addrinfo
|
58
74
|
|
75
|
+
# <!--
|
76
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
77
|
+
# - Addrinfo.tcp(host, port) => addrinfo
|
78
|
+
# -->
|
59
79
|
# returns an addrinfo object for TCP address.
|
60
80
|
#
|
61
81
|
# Addrinfo.tcp("localhost", "smtp") #=> #<Addrinfo: 127.0.0.1:25 TCP (localhost:smtp)>
|
62
82
|
#
|
63
83
|
def self.tcp: (String host, String | Integer service) -> Addrinfo
|
64
84
|
|
85
|
+
# <!--
|
86
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
87
|
+
# - Addrinfo.udp(host, port) => addrinfo
|
88
|
+
# -->
|
65
89
|
# returns an addrinfo object for UDP address.
|
66
90
|
#
|
67
91
|
# Addrinfo.udp("localhost", "daytime") #=> #<Addrinfo: 127.0.0.1:13 UDP (localhost:daytime)>
|
68
92
|
#
|
69
93
|
def self.udp: (String host, String | Integer service) -> Addrinfo
|
70
94
|
|
95
|
+
# <!--
|
96
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
97
|
+
# - Addrinfo.unix(path [, socktype]) => addrinfo
|
98
|
+
# -->
|
71
99
|
# returns an addrinfo object for UNIX socket address.
|
72
100
|
#
|
73
101
|
# *socktype* specifies the socket type. If it is omitted, :STREAM is used.
|
@@ -79,12 +107,20 @@ class Addrinfo
|
|
79
107
|
|
80
108
|
public
|
81
109
|
|
110
|
+
# <!--
|
111
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
112
|
+
# - addrinfo.afamily => integer
|
113
|
+
# -->
|
82
114
|
# returns the address family as an integer.
|
83
115
|
#
|
84
116
|
# Addrinfo.tcp("localhost", 80).afamily == Socket::AF_INET #=> true
|
85
117
|
#
|
86
118
|
def afamily: () -> Integer
|
87
119
|
|
120
|
+
# <!--
|
121
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
122
|
+
# - bind() { |sock| ... }
|
123
|
+
# -->
|
88
124
|
# creates a socket bound to self.
|
89
125
|
#
|
90
126
|
# If a block is given, it is called with the socket and the value of the block
|
@@ -96,8 +132,12 @@ class Addrinfo
|
|
96
132
|
# }
|
97
133
|
#
|
98
134
|
def bind: () -> Socket
|
99
|
-
|
|
135
|
+
| () { (Socket) -> void } -> void
|
100
136
|
|
137
|
+
# <!--
|
138
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
139
|
+
# - addrinfo.canonname => string or nil
|
140
|
+
# -->
|
101
141
|
# returns the canonical name as a string.
|
102
142
|
#
|
103
143
|
# nil is returned if no canonical name.
|
@@ -111,6 +151,11 @@ class Addrinfo
|
|
111
151
|
#
|
112
152
|
def canonname: () -> String
|
113
153
|
|
154
|
+
# <!--
|
155
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
156
|
+
# - addrinfo.connect([opts]) {|socket| ... }
|
157
|
+
# - addrinfo.connect([opts])
|
158
|
+
# -->
|
114
159
|
# creates a socket connected to the address of self.
|
115
160
|
#
|
116
161
|
# The optional argument *opts* is options represented by a hash. *opts* may have
|
@@ -131,6 +176,11 @@ class Addrinfo
|
|
131
176
|
def connect: (?timeout: Numeric) { (Socket) -> void } -> void
|
132
177
|
| (?timeout: Numeric) -> Socket
|
133
178
|
|
179
|
+
# <!--
|
180
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
181
|
+
# - addrinfo.connect_from([local_addr_args], [opts]) {|socket| ... }
|
182
|
+
# - addrinfo.connect_from([local_addr_args], [opts])
|
183
|
+
# -->
|
134
184
|
# creates a socket connected to the address of self.
|
135
185
|
#
|
136
186
|
# If one or more arguments given as *local_addr_args*, it is used as the local
|
@@ -162,10 +212,15 @@ class Addrinfo
|
|
162
212
|
# }
|
163
213
|
#
|
164
214
|
def connect_from: (String host, Integer port, ?timeout: Numeric) { (Socket) -> void } -> void
|
165
|
-
| (String host, Integer port, ?timeout: Numeric)
|
215
|
+
| (String host, Integer port, ?timeout: Numeric) -> Socket
|
166
216
|
| (Addrinfo sockaddr, ?timeout: Numeric) { (Socket) -> void } -> void
|
167
217
|
| (Addrinfo sockaddr, ?timeout: Numeric) -> Socket
|
168
218
|
|
219
|
+
# <!--
|
220
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
221
|
+
# - addrinfo.connect_to([remote_addr_args], [opts]) {|socket| ... }
|
222
|
+
# - addrinfo.connect_to([remote_addr_args], [opts])
|
223
|
+
# -->
|
169
224
|
# creates a socket connected to *remote_addr_args* and bound to self.
|
170
225
|
#
|
171
226
|
# The optional last argument *opts* is options represented by a hash. *opts* may
|
@@ -184,10 +239,14 @@ class Addrinfo
|
|
184
239
|
# }
|
185
240
|
#
|
186
241
|
def connect_to: (String host, Integer port, ?timeout: Numeric) { (Socket) -> void } -> void
|
187
|
-
| (String host, Integer port, ?timeout: Numeric)
|
242
|
+
| (String host, Integer port, ?timeout: Numeric) -> Socket
|
188
243
|
| (Addrinfo sockaddr, ?timeout: Numeric) { (Socket) -> void } -> void
|
189
244
|
| (Addrinfo sockaddr, ?timeout: Numeric) -> Socket
|
190
245
|
|
246
|
+
# <!--
|
247
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
248
|
+
# - family_addrinfo(*args)
|
249
|
+
# -->
|
191
250
|
# creates an Addrinfo object from the arguments.
|
192
251
|
#
|
193
252
|
# The arguments are interpreted as similar to self.
|
@@ -201,6 +260,11 @@ class Addrinfo
|
|
201
260
|
def family_addrinfo: (String host, Integer port) -> Addrinfo
|
202
261
|
| (String path) -> Addrinfo
|
203
262
|
|
263
|
+
# <!--
|
264
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
265
|
+
# - addrinfo.getnameinfo => [nodename, service]
|
266
|
+
# - addrinfo.getnameinfo(flags) => [nodename, service]
|
267
|
+
# -->
|
204
268
|
# returns nodename and service as a pair of strings. This converts struct
|
205
269
|
# sockaddr in addrinfo to textual representation.
|
206
270
|
#
|
@@ -211,8 +275,12 @@ class Addrinfo
|
|
211
275
|
# Addrinfo.tcp("127.0.0.1", 80).getnameinfo(Socket::NI_NUMERICSERV)
|
212
276
|
# #=> ["localhost", "80"]
|
213
277
|
#
|
214
|
-
def getnameinfo: (?Integer flags) -> [String, Integer]
|
278
|
+
def getnameinfo: (?Integer flags) -> [ String, Integer ]
|
215
279
|
|
280
|
+
# <!--
|
281
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
282
|
+
# - addrinfo.inspect => string
|
283
|
+
# -->
|
216
284
|
# returns a string which shows addrinfo in human-readable form.
|
217
285
|
#
|
218
286
|
# Addrinfo.tcp("localhost", 80).inspect #=> "#<Addrinfo: 127.0.0.1:80 TCP (localhost)>"
|
@@ -220,6 +288,10 @@ class Addrinfo
|
|
220
288
|
#
|
221
289
|
def inspect: () -> String
|
222
290
|
|
291
|
+
# <!--
|
292
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
293
|
+
# - addrinfo.inspect_sockaddr => string
|
294
|
+
# -->
|
223
295
|
# returns a string which shows the sockaddr in *addrinfo* with human-readable
|
224
296
|
# form.
|
225
297
|
#
|
@@ -229,6 +301,10 @@ class Addrinfo
|
|
229
301
|
#
|
230
302
|
def inspect_sockaddr: () -> String
|
231
303
|
|
304
|
+
# <!--
|
305
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
306
|
+
# - addrinfo.ip? => true or false
|
307
|
+
# -->
|
232
308
|
# returns true if addrinfo is internet (IPv4/IPv6) address. returns false
|
233
309
|
# otherwise.
|
234
310
|
#
|
@@ -238,6 +314,10 @@ class Addrinfo
|
|
238
314
|
#
|
239
315
|
def ip?: () -> bool
|
240
316
|
|
317
|
+
# <!--
|
318
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
319
|
+
# - addrinfo.ip_address => string
|
320
|
+
# -->
|
241
321
|
# Returns the IP address as a string.
|
242
322
|
#
|
243
323
|
# Addrinfo.tcp("127.0.0.1", 80).ip_address #=> "127.0.0.1"
|
@@ -245,6 +325,10 @@ class Addrinfo
|
|
245
325
|
#
|
246
326
|
def ip_address: () -> String
|
247
327
|
|
328
|
+
# <!--
|
329
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
330
|
+
# - addrinfo.ip_port => port
|
331
|
+
# -->
|
248
332
|
# Returns the port number as an integer.
|
249
333
|
#
|
250
334
|
# Addrinfo.tcp("127.0.0.1", 80).ip_port #=> 80
|
@@ -252,13 +336,21 @@ class Addrinfo
|
|
252
336
|
#
|
253
337
|
def ip_port: () -> Integer
|
254
338
|
|
339
|
+
# <!--
|
340
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
341
|
+
# - addrinfo.ip_unpack => [addr, port]
|
342
|
+
# -->
|
255
343
|
# Returns the IP address and port number as 2-element array.
|
256
344
|
#
|
257
345
|
# Addrinfo.tcp("127.0.0.1", 80).ip_unpack #=> ["127.0.0.1", 80]
|
258
346
|
# Addrinfo.tcp("::1", 80).ip_unpack #=> ["::1", 80]
|
259
347
|
#
|
260
|
-
def ip_unpack: () -> [String, Integer]
|
348
|
+
def ip_unpack: () -> [ String, Integer ]
|
261
349
|
|
350
|
+
# <!--
|
351
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
352
|
+
# - addrinfo.ipv4? => true or false
|
353
|
+
# -->
|
262
354
|
# returns true if addrinfo is IPv4 address. returns false otherwise.
|
263
355
|
#
|
264
356
|
# Addrinfo.tcp("127.0.0.1", 80).ipv4? #=> true
|
@@ -267,21 +359,37 @@ class Addrinfo
|
|
267
359
|
#
|
268
360
|
def ipv4?: () -> bool
|
269
361
|
|
362
|
+
# <!--
|
363
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
364
|
+
# - ipv4_loopback?()
|
365
|
+
# -->
|
270
366
|
# Returns true for IPv4 loopback address (127.0.0.0/8). It returns false
|
271
367
|
# otherwise.
|
272
368
|
#
|
273
369
|
def ipv4_loopback?: () -> bool
|
274
370
|
|
371
|
+
# <!--
|
372
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
373
|
+
# - ipv4_multicast?()
|
374
|
+
# -->
|
275
375
|
# Returns true for IPv4 multicast address (224.0.0.0/4). It returns false
|
276
376
|
# otherwise.
|
277
377
|
#
|
278
378
|
def ipv4_multicast?: () -> bool
|
279
379
|
|
380
|
+
# <!--
|
381
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
382
|
+
# - ipv4_private?()
|
383
|
+
# -->
|
280
384
|
# Returns true for IPv4 private address (10.0.0.0/8, 172.16.0.0/12,
|
281
385
|
# 192.168.0.0/16). It returns false otherwise.
|
282
386
|
#
|
283
387
|
def ipv4_private?: () -> bool
|
284
388
|
|
389
|
+
# <!--
|
390
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
391
|
+
# - addrinfo.ipv6? => true or false
|
392
|
+
# -->
|
285
393
|
# returns true if addrinfo is IPv6 address. returns false otherwise.
|
286
394
|
#
|
287
395
|
# Addrinfo.tcp("127.0.0.1", 80).ipv6? #=> false
|
@@ -290,50 +398,90 @@ class Addrinfo
|
|
290
398
|
#
|
291
399
|
def ipv6?: () -> bool
|
292
400
|
|
401
|
+
# <!--
|
402
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
403
|
+
# - ipv6_linklocal?()
|
404
|
+
# -->
|
293
405
|
# Returns true for IPv6 link local address (ff80::/10). It returns false
|
294
406
|
# otherwise.
|
295
407
|
#
|
296
408
|
def ipv6_linklocal?: () -> bool
|
297
409
|
|
410
|
+
# <!--
|
411
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
412
|
+
# - ipv6_loopback?()
|
413
|
+
# -->
|
298
414
|
# Returns true for IPv6 loopback address (::1). It returns false otherwise.
|
299
415
|
#
|
300
416
|
def ipv6_loopback?: () -> bool
|
301
417
|
|
418
|
+
# <!--
|
419
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
420
|
+
# - ipv6_mc_global?()
|
421
|
+
# -->
|
302
422
|
# Returns true for IPv6 multicast global scope address. It returns false
|
303
423
|
# otherwise.
|
304
424
|
#
|
305
425
|
def ipv6_mc_global?: () -> bool
|
306
426
|
|
427
|
+
# <!--
|
428
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
429
|
+
# - ipv6_mc_linklocal?()
|
430
|
+
# -->
|
307
431
|
# Returns true for IPv6 multicast link-local scope address. It returns false
|
308
432
|
# otherwise.
|
309
433
|
#
|
310
434
|
def ipv6_mc_linklocal?: () -> bool
|
311
435
|
|
436
|
+
# <!--
|
437
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
438
|
+
# - ipv6_mc_nodelocal?()
|
439
|
+
# -->
|
312
440
|
# Returns true for IPv6 multicast node-local scope address. It returns false
|
313
441
|
# otherwise.
|
314
442
|
#
|
315
443
|
def ipv6_mc_nodelocal?: () -> bool
|
316
444
|
|
445
|
+
# <!--
|
446
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
447
|
+
# - ipv6_mc_orglocal?()
|
448
|
+
# -->
|
317
449
|
# Returns true for IPv6 multicast organization-local scope address. It returns
|
318
450
|
# false otherwise.
|
319
451
|
#
|
320
452
|
def ipv6_mc_orglocal?: () -> bool
|
321
453
|
|
454
|
+
# <!--
|
455
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
456
|
+
# - ipv6_mc_sitelocal?()
|
457
|
+
# -->
|
322
458
|
# Returns true for IPv6 multicast site-local scope address. It returns false
|
323
459
|
# otherwise.
|
324
460
|
#
|
325
461
|
def ipv6_mc_sitelocal?: () -> bool
|
326
462
|
|
463
|
+
# <!--
|
464
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
465
|
+
# - ipv6_multicast?()
|
466
|
+
# -->
|
327
467
|
# Returns true for IPv6 multicast address (ff00::/8). It returns false
|
328
468
|
# otherwise.
|
329
469
|
#
|
330
470
|
def ipv6_multicast?: () -> bool
|
331
471
|
|
472
|
+
# <!--
|
473
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
474
|
+
# - ipv6_sitelocal?()
|
475
|
+
# -->
|
332
476
|
# Returns true for IPv6 site local address (ffc0::/10). It returns false
|
333
477
|
# otherwise.
|
334
478
|
#
|
335
479
|
def ipv6_sitelocal?: () -> bool
|
336
480
|
|
481
|
+
# <!--
|
482
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
483
|
+
# - ipv6_to_ipv4()
|
484
|
+
# -->
|
337
485
|
# Returns IPv4 address of IPv4 mapped/compatible IPv6 address. It returns nil if
|
338
486
|
# `self` is not IPv4 mapped/compatible IPv6 address.
|
339
487
|
#
|
@@ -345,25 +493,45 @@ class Addrinfo
|
|
345
493
|
#
|
346
494
|
def ipv6_to_ipv4: () -> Addrinfo?
|
347
495
|
|
496
|
+
# <!--
|
497
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
498
|
+
# - ipv6_unique_local?()
|
499
|
+
# -->
|
348
500
|
# Returns true for IPv6 unique local address (fc00::/7, RFC4193). It returns
|
349
501
|
# false otherwise.
|
350
502
|
#
|
351
503
|
def ipv6_unique_local?: () -> bool
|
352
504
|
|
505
|
+
# <!--
|
506
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
507
|
+
# - ipv6_unspecified?()
|
508
|
+
# -->
|
353
509
|
# Returns true for IPv6 unspecified address (::). It returns false otherwise.
|
354
510
|
#
|
355
511
|
def ipv6_unspecified?: () -> bool
|
356
512
|
|
513
|
+
# <!--
|
514
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
515
|
+
# - ipv6_v4compat?()
|
516
|
+
# -->
|
357
517
|
# Returns true for IPv4-compatible IPv6 address (::/80). It returns false
|
358
518
|
# otherwise.
|
359
519
|
#
|
360
520
|
def ipv6_v4compat?: () -> bool
|
361
521
|
|
522
|
+
# <!--
|
523
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
524
|
+
# - ipv6_v4mapped?()
|
525
|
+
# -->
|
362
526
|
# Returns true for IPv4-mapped IPv6 address (::ffff:0:0/80). It returns false
|
363
527
|
# otherwise.
|
364
528
|
#
|
365
529
|
def ipv6_v4mapped?: () -> bool
|
366
530
|
|
531
|
+
# <!--
|
532
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
533
|
+
# - listen(backlog=Socket::SOMAXCONN) { |sock| ... }
|
534
|
+
# -->
|
367
535
|
# creates a listening socket bound to self.
|
368
536
|
#
|
369
537
|
def listen: (Integer backlog) -> void
|
@@ -372,24 +540,37 @@ class Addrinfo
|
|
372
540
|
|
373
541
|
def marshal_load: (String) -> instance
|
374
542
|
|
543
|
+
# <!--
|
544
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
545
|
+
# - addrinfo.pfamily => integer
|
546
|
+
# -->
|
375
547
|
# returns the protocol family as an integer.
|
376
548
|
#
|
377
549
|
# Addrinfo.tcp("localhost", 80).pfamily == Socket::PF_INET #=> true
|
378
550
|
#
|
379
551
|
def pfamily: () -> Integer
|
380
552
|
|
553
|
+
# <!--
|
554
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
555
|
+
# - addrinfo.protocol => integer
|
556
|
+
# -->
|
381
557
|
# returns the socket type as an integer.
|
382
558
|
#
|
383
559
|
# Addrinfo.tcp("localhost", 80).protocol == Socket::IPPROTO_TCP #=> true
|
384
560
|
#
|
385
561
|
def protocol: () -> Integer
|
386
562
|
|
563
|
+
# <!--
|
564
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
565
|
+
# - addrinfo.socktype => integer
|
566
|
+
# -->
|
387
567
|
# returns the socket type as an integer.
|
388
568
|
#
|
389
569
|
# Addrinfo.tcp("localhost", 80).socktype == Socket::SOCK_STREAM #=> true
|
390
570
|
#
|
391
571
|
def socktype: () -> Integer
|
392
572
|
|
573
|
+
# <!-- rdoc-file=ext/socket/raddrinfo.c -->
|
393
574
|
# returns the socket address as packed struct sockaddr string.
|
394
575
|
#
|
395
576
|
# Addrinfo.tcp("localhost", 80).to_sockaddr
|
@@ -397,6 +578,11 @@ class Addrinfo
|
|
397
578
|
#
|
398
579
|
def to_s: () -> String
|
399
580
|
|
581
|
+
# <!--
|
582
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
583
|
+
# - addrinfo.to_sockaddr => string
|
584
|
+
# - addrinfo.to_s => string
|
585
|
+
# -->
|
400
586
|
# returns the socket address as packed struct sockaddr string.
|
401
587
|
#
|
402
588
|
# Addrinfo.tcp("localhost", 80).to_sockaddr
|
@@ -404,6 +590,10 @@ class Addrinfo
|
|
404
590
|
#
|
405
591
|
def to_sockaddr: () -> String
|
406
592
|
|
593
|
+
# <!--
|
594
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
595
|
+
# - addrinfo.unix? => true or false
|
596
|
+
# -->
|
407
597
|
# returns true if addrinfo is UNIX address. returns false otherwise.
|
408
598
|
#
|
409
599
|
# Addrinfo.tcp("127.0.0.1", 80).unix? #=> false
|
@@ -412,6 +602,10 @@ class Addrinfo
|
|
412
602
|
#
|
413
603
|
def unix?: () -> bool
|
414
604
|
|
605
|
+
# <!--
|
606
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
607
|
+
# - addrinfo.unix_path => path
|
608
|
+
# -->
|
415
609
|
# Returns the socket path as a string.
|
416
610
|
#
|
417
611
|
# Addrinfo.unix("/tmp/sock").unix_path #=> "/tmp/sock"
|
@@ -420,6 +614,13 @@ class Addrinfo
|
|
420
614
|
|
421
615
|
private
|
422
616
|
|
617
|
+
# <!--
|
618
|
+
# rdoc-file=ext/socket/raddrinfo.c
|
619
|
+
# - Addrinfo.new(sockaddr) => addrinfo
|
620
|
+
# - Addrinfo.new(sockaddr, family) => addrinfo
|
621
|
+
# - Addrinfo.new(sockaddr, family, socktype) => addrinfo
|
622
|
+
# - Addrinfo.new(sockaddr, family, socktype, protocol) => addrinfo
|
623
|
+
# -->
|
423
624
|
# returns a new instance of Addrinfo. The instance contains sockaddr, family,
|
424
625
|
# socktype, protocol. sockaddr means struct sockaddr which can be used for
|
425
626
|
# connect(2), etc. family, socktype and protocol are integers which is used for
|