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,3 +1,4 @@
|
|
1
|
+
# <!-- rdoc-file=ext/socket/tcpserver.c -->
|
1
2
|
# TCPServer represents a TCP/IP server socket.
|
2
3
|
#
|
3
4
|
# A simple TCP server may look like:
|
@@ -24,9 +25,14 @@
|
|
24
25
|
# client.close
|
25
26
|
# end
|
26
27
|
# end
|
28
|
+
#
|
27
29
|
class TCPServer < TCPSocket
|
28
30
|
public
|
29
31
|
|
32
|
+
# <!--
|
33
|
+
# rdoc-file=ext/socket/tcpserver.c
|
34
|
+
# - tcpserver.accept => tcpsocket
|
35
|
+
# -->
|
30
36
|
# Accepts an incoming connection. It returns a new TCPSocket object.
|
31
37
|
#
|
32
38
|
# TCPServer.open("127.0.0.1", 14641) {|serv|
|
@@ -37,6 +43,10 @@ class TCPServer < TCPSocket
|
|
37
43
|
#
|
38
44
|
def accept: () -> TCPSocket
|
39
45
|
|
46
|
+
# <!--
|
47
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
48
|
+
# - tcpserver.accept_nonblock([options]) => tcpsocket
|
49
|
+
# -->
|
40
50
|
# Accepts an incoming connection using accept(2) after O_NONBLOCK is set for the
|
41
51
|
# underlying file descriptor. It returns an accepted TCPSocket for the incoming
|
42
52
|
# connection.
|
@@ -70,9 +80,12 @@ class TCPServer < TCPSocket
|
|
70
80
|
# * TCPServer#accept
|
71
81
|
# * Socket#accept
|
72
82
|
#
|
73
|
-
#
|
74
83
|
def accept_nonblock: (?exception: boolish) -> (TCPSocket | :wait_readable)
|
75
84
|
|
85
|
+
# <!--
|
86
|
+
# rdoc-file=ext/socket/tcpserver.c
|
87
|
+
# - socket.listen( int ) => 0
|
88
|
+
# -->
|
76
89
|
# Listens for connections, using the specified `int` as the backlog. A call to
|
77
90
|
# *listen* only applies if the `socket` is of type SOCK_STREAM or
|
78
91
|
# SOCK_SEQPACKET.
|
@@ -142,9 +155,12 @@ class TCPServer < TCPSocket
|
|
142
155
|
# * listen manual pages on unix-based systems
|
143
156
|
# * listen function in Microsoft's Winsock functions reference
|
144
157
|
#
|
145
|
-
#
|
146
158
|
def listen: (Integer backlog) -> void
|
147
159
|
|
160
|
+
# <!--
|
161
|
+
# rdoc-file=ext/socket/tcpserver.c
|
162
|
+
# - tcpserver.sysaccept => file_descriptor
|
163
|
+
# -->
|
148
164
|
# Returns a file descriptor of a accepted connection.
|
149
165
|
#
|
150
166
|
# TCPServer.open("127.0.0.1", 28561) {|serv|
|
@@ -160,6 +176,10 @@ class TCPServer < TCPSocket
|
|
160
176
|
|
161
177
|
def __accept_nonblock: (untyped) -> untyped
|
162
178
|
|
179
|
+
# <!--
|
180
|
+
# rdoc-file=ext/socket/tcpserver.c
|
181
|
+
# - TCPServer.new([hostname,] port) => tcpserver
|
182
|
+
# -->
|
163
183
|
# Creates a new server socket bound to *port*.
|
164
184
|
#
|
165
185
|
# If *hostname* is given, the socket is bound to it.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# <!-- rdoc-file=ext/socket/tcpsocket.c -->
|
1
2
|
# TCPSocket represents a TCP/IP client socket.
|
2
3
|
#
|
3
4
|
# A simple client may look like:
|
@@ -11,7 +12,12 @@
|
|
11
12
|
# end
|
12
13
|
#
|
13
14
|
# s.close # close socket when done
|
15
|
+
#
|
14
16
|
class TCPSocket < IPSocket
|
17
|
+
# <!--
|
18
|
+
# rdoc-file=ext/socket/tcpsocket.c
|
19
|
+
# - TCPSocket.gethostbyname(hostname) => [official_hostname, alias_hostnames, address_family, *address_list]
|
20
|
+
# -->
|
15
21
|
# Use Addrinfo.getaddrinfo instead. This method is deprecated for the following
|
16
22
|
# reasons:
|
17
23
|
#
|
@@ -27,9 +33,14 @@ class TCPSocket < IPSocket
|
|
27
33
|
# TCPSocket.gethostbyname("localhost")
|
28
34
|
# #=> ["localhost", ["hal"], 2, "127.0.0.1"]
|
29
35
|
#
|
30
|
-
def self.gethostbyname: (String host) -> [String, Array[String], Integer, String]
|
36
|
+
def self.gethostbyname: (String host) -> [ String, Array[String], Integer, String ]
|
31
37
|
|
32
38
|
private
|
33
39
|
|
40
|
+
# <!--
|
41
|
+
# rdoc-file=lib/resolv-replace.rb
|
42
|
+
# - new(host, serv, *rest)
|
43
|
+
# -->
|
44
|
+
#
|
34
45
|
def initialize: (String remote_host, Integer remote_port, ?String local_host, ?Integer local_port) -> untyped
|
35
46
|
end
|
@@ -1,7 +1,13 @@
|
|
1
|
+
# <!-- rdoc-file=ext/socket/udpsocket.c -->
|
1
2
|
# UDPSocket represents a UDP/IP socket.
|
3
|
+
#
|
2
4
|
class UDPSocket < IPSocket
|
3
5
|
public
|
4
6
|
|
7
|
+
# <!--
|
8
|
+
# rdoc-file=ext/socket/udpsocket.c
|
9
|
+
# - udpsocket.bind(host, port) #=> 0
|
10
|
+
# -->
|
5
11
|
# Binds *udpsocket* to *host*:*port*.
|
6
12
|
#
|
7
13
|
# u1 = UDPSocket.new
|
@@ -11,6 +17,10 @@ class UDPSocket < IPSocket
|
|
11
17
|
#
|
12
18
|
def bind: (String host, Integer port) -> void
|
13
19
|
|
20
|
+
# <!--
|
21
|
+
# rdoc-file=ext/socket/udpsocket.c
|
22
|
+
# - udpsocket.connect(host, port) => 0
|
23
|
+
# -->
|
14
24
|
# Connects *udpsocket* to *host*:*port*.
|
15
25
|
#
|
16
26
|
# This makes possible to send without destination address.
|
@@ -24,6 +34,10 @@ class UDPSocket < IPSocket
|
|
24
34
|
#
|
25
35
|
def connect: (String host, Integer port) -> void
|
26
36
|
|
37
|
+
# <!--
|
38
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
39
|
+
# - udpsocket.recvfrom_nonblock(maxlen [, flags[, outbuf [, options]]]) => [mesg, sender_inet_addr]
|
40
|
+
# -->
|
27
41
|
# Receives up to *maxlen* bytes from `udpsocket` using recvfrom(2) after
|
28
42
|
# O_NONBLOCK is set for the underlying file descriptor. *flags* is zero or more
|
29
43
|
# of the `MSG_` options. The first element of the results, *mesg*, is the data
|
@@ -73,9 +87,14 @@ class UDPSocket < IPSocket
|
|
73
87
|
# ### See
|
74
88
|
# * Socket#recvfrom
|
75
89
|
#
|
76
|
-
|
77
|
-
def recvfrom_nonblock: (Integer len, ?Integer flag, ?String outbuf, ?exception: boolish) -> [String, [String, Integer, String, String]]
|
90
|
+
def recvfrom_nonblock: (Integer len, ?Integer flag, ?String outbuf, ?exception: boolish) -> [ String, [ String, Integer, String, String ] ]
|
78
91
|
|
92
|
+
# <!--
|
93
|
+
# rdoc-file=ext/socket/udpsocket.c
|
94
|
+
# - udpsocket.send(mesg, flags, host, port) => numbytes_sent
|
95
|
+
# - udpsocket.send(mesg, flags, sockaddr_to) => numbytes_sent
|
96
|
+
# - udpsocket.send(mesg, flags) => numbytes_sent
|
97
|
+
# -->
|
79
98
|
# Sends *mesg* via *udpsocket*.
|
80
99
|
#
|
81
100
|
# *flags* should be a bitwise OR of Socket::MSG_* constants.
|
@@ -97,6 +116,10 @@ class UDPSocket < IPSocket
|
|
97
116
|
|
98
117
|
def __recvfrom_nonblock: (untyped, untyped, untyped, untyped) -> untyped
|
99
118
|
|
119
|
+
# <!--
|
120
|
+
# rdoc-file=ext/socket/udpsocket.c
|
121
|
+
# - UDPSocket.new([address_family]) => socket
|
122
|
+
# -->
|
100
123
|
# Creates a new UDPSocket object.
|
101
124
|
#
|
102
125
|
# *address_family* should be an integer, a string or a symbol: Socket::AF_INET,
|
@@ -1,7 +1,13 @@
|
|
1
|
+
# <!-- rdoc-file=ext/socket/unixserver.c -->
|
1
2
|
# UNIXServer represents a UNIX domain stream server socket.
|
3
|
+
#
|
2
4
|
class UNIXServer < UNIXSocket
|
3
5
|
public
|
4
6
|
|
7
|
+
# <!--
|
8
|
+
# rdoc-file=ext/socket/unixserver.c
|
9
|
+
# - unixserver.accept => unixsocket
|
10
|
+
# -->
|
5
11
|
# Accepts an incoming connection. It returns a new UNIXSocket object.
|
6
12
|
#
|
7
13
|
# UNIXServer.open("/tmp/sock") {|serv|
|
@@ -15,6 +21,10 @@ class UNIXServer < UNIXSocket
|
|
15
21
|
#
|
16
22
|
def accept: () -> UNIXSocket
|
17
23
|
|
24
|
+
# <!--
|
25
|
+
# rdoc-file=ext/socket/lib/socket.rb
|
26
|
+
# - unixserver.accept_nonblock([options]) => unixsocket
|
27
|
+
# -->
|
18
28
|
# Accepts an incoming connection using accept(2) after O_NONBLOCK is set for the
|
19
29
|
# underlying file descriptor. It returns an accepted UNIXSocket for the incoming
|
20
30
|
# connection.
|
@@ -48,9 +58,12 @@ class UNIXServer < UNIXSocket
|
|
48
58
|
# * UNIXServer#accept
|
49
59
|
# * Socket#accept
|
50
60
|
#
|
51
|
-
#
|
52
61
|
def accept_nonblock: (?exception: boolish) -> (UNIXSocket | :wait_readable)
|
53
62
|
|
63
|
+
# <!--
|
64
|
+
# rdoc-file=ext/socket/unixserver.c
|
65
|
+
# - socket.listen( int ) => 0
|
66
|
+
# -->
|
54
67
|
# Listens for connections, using the specified `int` as the backlog. A call to
|
55
68
|
# *listen* only applies if the `socket` is of type SOCK_STREAM or
|
56
69
|
# SOCK_SEQPACKET.
|
@@ -120,9 +133,12 @@ class UNIXServer < UNIXSocket
|
|
120
133
|
# * listen manual pages on unix-based systems
|
121
134
|
# * listen function in Microsoft's Winsock functions reference
|
122
135
|
#
|
123
|
-
#
|
124
136
|
def listen: (Integer backlog) -> void
|
125
137
|
|
138
|
+
# <!--
|
139
|
+
# rdoc-file=ext/socket/unixserver.c
|
140
|
+
# - unixserver.sysaccept => file_descriptor
|
141
|
+
# -->
|
126
142
|
# Accepts a new connection. It returns the new file descriptor which is an
|
127
143
|
# integer.
|
128
144
|
#
|
@@ -142,6 +158,10 @@ class UNIXServer < UNIXSocket
|
|
142
158
|
|
143
159
|
def __accept_nonblock: (untyped) -> untyped
|
144
160
|
|
161
|
+
# <!--
|
162
|
+
# rdoc-file=ext/socket/unixserver.c
|
163
|
+
# - UNIXServer.new(path) => unixserver
|
164
|
+
# -->
|
145
165
|
# Creates a new UNIX server socket bound to *path*.
|
146
166
|
#
|
147
167
|
# require 'socket'
|
@@ -1,5 +1,12 @@
|
|
1
|
+
# <!-- rdoc-file=ext/socket/unixsocket.c -->
|
1
2
|
# UNIXSocket represents a UNIX domain stream client socket.
|
3
|
+
#
|
2
4
|
class UNIXSocket < BasicSocket
|
5
|
+
# <!--
|
6
|
+
# rdoc-file=ext/socket/unixsocket.c
|
7
|
+
# - UNIXSocket.pair([type [, protocol]]) => [unixsocket1, unixsocket2]
|
8
|
+
# - UNIXSocket.socketpair([type [, protocol]]) => [unixsocket1, unixsocket2]
|
9
|
+
# -->
|
3
10
|
# Creates a pair of sockets connected to each other.
|
4
11
|
#
|
5
12
|
# *socktype* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
|
@@ -12,8 +19,13 @@ class UNIXSocket < BasicSocket
|
|
12
19
|
# s1.send "b", 0
|
13
20
|
# p s2.recv(10) #=> "ab"
|
14
21
|
#
|
15
|
-
def self.pair: (?Symbol socktype, ?Integer protocol) -> [instance, instance]
|
22
|
+
def self.pair: (?Symbol socktype, ?Integer protocol) -> [ instance, instance ]
|
16
23
|
|
24
|
+
# <!--
|
25
|
+
# rdoc-file=ext/socket/unixsocket.c
|
26
|
+
# - UNIXSocket.pair([type [, protocol]]) => [unixsocket1, unixsocket2]
|
27
|
+
# - UNIXSocket.socketpair([type [, protocol]]) => [unixsocket1, unixsocket2]
|
28
|
+
# -->
|
17
29
|
# Creates a pair of sockets connected to each other.
|
18
30
|
#
|
19
31
|
# *socktype* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
|
@@ -26,10 +38,14 @@ class UNIXSocket < BasicSocket
|
|
26
38
|
# s1.send "b", 0
|
27
39
|
# p s2.recv(10) #=> "ab"
|
28
40
|
#
|
29
|
-
def self.socketpair: (?Symbol socktype, ?Integer protocol) -> [instance, instance]
|
41
|
+
def self.socketpair: (?Symbol socktype, ?Integer protocol) -> [ instance, instance ]
|
30
42
|
|
31
43
|
public
|
32
44
|
|
45
|
+
# <!--
|
46
|
+
# rdoc-file=ext/socket/unixsocket.c
|
47
|
+
# - unixsocket.addr => [address_family, unix_path]
|
48
|
+
# -->
|
33
49
|
# Returns the local address as an array which contains address_family and
|
34
50
|
# unix_path.
|
35
51
|
#
|
@@ -37,8 +53,12 @@ class UNIXSocket < BasicSocket
|
|
37
53
|
# serv = UNIXServer.new("/tmp/sock")
|
38
54
|
# p serv.addr #=> ["AF_UNIX", "/tmp/sock"]
|
39
55
|
#
|
40
|
-
def addr: () -> [String, String]
|
56
|
+
def addr: () -> [ String, String ]
|
41
57
|
|
58
|
+
# <!--
|
59
|
+
# rdoc-file=ext/socket/unixsocket.c
|
60
|
+
# - unixsocket.path => path
|
61
|
+
# -->
|
42
62
|
# Returns the path of the local address of unixsocket.
|
43
63
|
#
|
44
64
|
# s = UNIXServer.new("/tmp/sock")
|
@@ -46,6 +66,10 @@ class UNIXSocket < BasicSocket
|
|
46
66
|
#
|
47
67
|
def path: () -> String
|
48
68
|
|
69
|
+
# <!--
|
70
|
+
# rdoc-file=ext/socket/unixsocket.c
|
71
|
+
# - unixsocket.peeraddr => [address_family, unix_path]
|
72
|
+
# -->
|
49
73
|
# Returns the remote address as an array which contains address_family and
|
50
74
|
# unix_path.
|
51
75
|
#
|
@@ -54,8 +78,12 @@ class UNIXSocket < BasicSocket
|
|
54
78
|
# c = UNIXSocket.new("/tmp/sock")
|
55
79
|
# p c.peeraddr #=> ["AF_UNIX", "/tmp/sock"]
|
56
80
|
#
|
57
|
-
def peeraddr: () -> [String, String]
|
81
|
+
def peeraddr: () -> [ String, String ]
|
58
82
|
|
83
|
+
# <!--
|
84
|
+
# rdoc-file=ext/socket/unixsocket.c
|
85
|
+
# - unixsocket.recv_io([klass [, mode]]) => io
|
86
|
+
# -->
|
59
87
|
# Example
|
60
88
|
#
|
61
89
|
# UNIXServer.open("/tmp/sock") {|serv|
|
@@ -80,6 +108,10 @@ class UNIXSocket < BasicSocket
|
|
80
108
|
#
|
81
109
|
def recv_io: (?singleton(BasicSocket), ?String mode) -> BasicSocket
|
82
110
|
|
111
|
+
# <!--
|
112
|
+
# rdoc-file=ext/socket/unixsocket.c
|
113
|
+
# - unixsocket.recvfrom(maxlen [, flags[, outbuf]]) => [mesg, unixaddress]
|
114
|
+
# -->
|
83
115
|
# Receives a message via *unixsocket*.
|
84
116
|
#
|
85
117
|
# *maxlen* is the maximum number of bytes to receive.
|
@@ -101,8 +133,12 @@ class UNIXSocket < BasicSocket
|
|
101
133
|
# s1.send "a", 0, s2_ai
|
102
134
|
# p s3.recvfrom(10) #=> ["a", ["AF_UNIX", "/tmp/sock1"]]
|
103
135
|
#
|
104
|
-
def recvfrom: (Integer maxlen, ?Integer flags, ?String outbuf) -> [String, [String, String]]
|
136
|
+
def recvfrom: (Integer maxlen, ?Integer flags, ?String outbuf) -> [ String, [ String, String ] ]
|
105
137
|
|
138
|
+
# <!--
|
139
|
+
# rdoc-file=ext/socket/unixsocket.c
|
140
|
+
# - unixsocket.send_io(io) => nil
|
141
|
+
# -->
|
106
142
|
# Sends *io* as file descriptor passing.
|
107
143
|
#
|
108
144
|
# s1, s2 = UNIXSocket.pair
|
@@ -121,6 +157,10 @@ class UNIXSocket < BasicSocket
|
|
121
157
|
|
122
158
|
private
|
123
159
|
|
160
|
+
# <!--
|
161
|
+
# rdoc-file=ext/socket/unixsocket.c
|
162
|
+
# - UNIXSocket.new(path) => unixsocket
|
163
|
+
# -->
|
124
164
|
# Creates a new UNIX client socket connected to *path*.
|
125
165
|
#
|
126
166
|
# require 'socket'
|