rbs 2.0.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +34 -0
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +82 -0
- data/README.md +6 -1
- data/Rakefile +56 -21
- 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 +1214 -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 +1060 -142
- 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 +2319 -318
- 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/docs/syntax.md +54 -11
- data/ext/rbs_extension/extconf.rb +1 -0
- data/ext/rbs_extension/lexer.h +5 -0
- data/ext/rbs_extension/lexstate.c +6 -0
- data/ext/rbs_extension/parser.c +85 -10
- data/ext/rbs_extension/ruby_objs.c +4 -2
- data/ext/rbs_extension/ruby_objs.h +2 -2
- data/goodcheck.yml +0 -11
- 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/ast/members.rb +21 -13
- data/lib/rbs/buffer.rb +17 -11
- data/lib/rbs/cli.rb +48 -1
- data/lib/rbs/definition_builder/method_builder.rb +28 -16
- data/lib/rbs/definition_builder.rb +6 -2
- data/lib/rbs/environment.rb +8 -4
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/type_alias_regularity.rb +6 -4
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +1 -1
- data/lib/rbs/validator.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +54 -4
- data/lib/rbs.rb +0 -2
- data/schema/typeParam.json +3 -3
- 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/buffer.rbs +6 -2
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/members.rbs +24 -18
- data/sig/method_builder.rbs +5 -4
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/sig/validator.rbs +3 -1
- data/sig/writer.rbs +79 -2
- 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 +649 -21
- 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 +1147 -145
- 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/manifest.yaml +1 -0
- data/stdlib/net-http/0/net-http.rbs +1513 -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 +423 -109
- 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 +558 -329
- data/stdlib/uri/0/http.rbs +60 -114
- 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 +18 -6
- data/lib/rbs/location.rb +0 -221
- data/sig/char_scanner.rbs +0 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=lib/forwardable.rb -->
|
|
1
2
|
# The Forwardable module provides delegation of specified methods to a
|
|
2
3
|
# designated object, using the methods #def_delegator and #def_delegators.
|
|
3
4
|
#
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
# def_delegators :@q, :clear, :first, :push, :shift, :size
|
|
62
63
|
# end
|
|
63
64
|
#
|
|
64
|
-
# q = Queue.new
|
|
65
|
+
# q = Thread::Queue.new
|
|
65
66
|
# q.enq 1, 2, 3, 4, 5
|
|
66
67
|
# q.push 6
|
|
67
68
|
#
|
|
@@ -94,18 +95,36 @@
|
|
|
94
95
|
# `delegate.rb`.
|
|
95
96
|
#
|
|
96
97
|
module Forwardable
|
|
98
|
+
# <!-- rdoc-file=lib/forwardable.rb -->
|
|
99
|
+
# Version of `forwardable.rb`
|
|
100
|
+
#
|
|
97
101
|
VERSION: String
|
|
98
102
|
|
|
99
103
|
FORWARDABLE_VERSION: String
|
|
100
104
|
|
|
105
|
+
# <!--
|
|
106
|
+
# rdoc-file=lib/forwardable.rb
|
|
107
|
+
# - delegate method => accessor
|
|
108
|
+
# - delegate [method, method, ...] => accessor
|
|
109
|
+
# -->
|
|
101
110
|
# Takes a hash as its argument. The key is a symbol or an array of symbols.
|
|
102
111
|
# These symbols correspond to method names, instance variable names, or constant
|
|
103
112
|
# names (see def_delegator). The value is the accessor to which the methods
|
|
104
113
|
# will be delegated.
|
|
114
|
+
#
|
|
105
115
|
def instance_delegate: (Hash[Symbol | Array[Symbol], Symbol] hash) -> void
|
|
106
116
|
|
|
117
|
+
# <!--
|
|
118
|
+
# rdoc-file=lib/forwardable.rb
|
|
119
|
+
# - delegate(hash)
|
|
120
|
+
# -->
|
|
121
|
+
#
|
|
107
122
|
alias delegate instance_delegate
|
|
108
123
|
|
|
124
|
+
# <!--
|
|
125
|
+
# rdoc-file=lib/forwardable.rb
|
|
126
|
+
# - def_instance_delegators(accessor, *methods)
|
|
127
|
+
# -->
|
|
109
128
|
# Shortcut for defining multiple delegator methods, but with no provision for
|
|
110
129
|
# using a different name. The following two code samples have the same effect:
|
|
111
130
|
#
|
|
@@ -117,8 +136,17 @@ module Forwardable
|
|
|
117
136
|
#
|
|
118
137
|
def def_instance_delegators: (Symbol | String accessor, *Symbol methods) -> void
|
|
119
138
|
|
|
139
|
+
# <!--
|
|
140
|
+
# rdoc-file=lib/forwardable.rb
|
|
141
|
+
# - def_delegators(accessor, *methods)
|
|
142
|
+
# -->
|
|
143
|
+
#
|
|
120
144
|
alias def_delegators def_instance_delegators
|
|
121
145
|
|
|
146
|
+
# <!--
|
|
147
|
+
# rdoc-file=lib/forwardable.rb
|
|
148
|
+
# - def_instance_delegator(accessor, method, ali = method)
|
|
149
|
+
# -->
|
|
122
150
|
# Define `method` as delegator instance method with an optional alias name
|
|
123
151
|
# `ali`. Method calls to `ali` will be delegated to `accessor.method`.
|
|
124
152
|
# `accessor` should be a method name, instance variable name, or constant name.
|
|
@@ -145,9 +173,15 @@ module Forwardable
|
|
|
145
173
|
#
|
|
146
174
|
def def_instance_delegator: (Symbol | String accessor, Symbol method, ?Symbol ali) -> void
|
|
147
175
|
|
|
176
|
+
# <!--
|
|
177
|
+
# rdoc-file=lib/forwardable.rb
|
|
178
|
+
# - def_delegator(accessor, method, ali = method)
|
|
179
|
+
# -->
|
|
180
|
+
#
|
|
148
181
|
alias def_delegator def_instance_delegator
|
|
149
182
|
end
|
|
150
183
|
|
|
184
|
+
# <!-- rdoc-file=lib/forwardable.rb -->
|
|
151
185
|
# SingleForwardable can be used to setup delegation at the object level as well.
|
|
152
186
|
#
|
|
153
187
|
# printer = String.new
|
|
@@ -175,13 +209,28 @@ end
|
|
|
175
209
|
# def_instance_delegator and def_single_delegator, etc.
|
|
176
210
|
#
|
|
177
211
|
module SingleForwardable
|
|
212
|
+
# <!--
|
|
213
|
+
# rdoc-file=lib/forwardable.rb
|
|
214
|
+
# - delegate method => accessor
|
|
215
|
+
# - delegate [method, method, ...] => accessor
|
|
216
|
+
# -->
|
|
178
217
|
# Takes a hash as its argument. The key is a symbol or an array of symbols.
|
|
179
218
|
# These symbols correspond to method names. The value is the accessor to which
|
|
180
219
|
# the methods will be delegated.
|
|
220
|
+
#
|
|
181
221
|
def single_delegate: (Hash[Symbol | Array[Symbol], Symbol] hash) -> void
|
|
182
222
|
|
|
223
|
+
# <!--
|
|
224
|
+
# rdoc-file=lib/forwardable.rb
|
|
225
|
+
# - delegate(hash)
|
|
226
|
+
# -->
|
|
227
|
+
#
|
|
183
228
|
alias delegate single_delegate
|
|
184
229
|
|
|
230
|
+
# <!--
|
|
231
|
+
# rdoc-file=lib/forwardable.rb
|
|
232
|
+
# - def_single_delegators(accessor, *methods)
|
|
233
|
+
# -->
|
|
185
234
|
# Shortcut for defining multiple delegator methods, but with no provision for
|
|
186
235
|
# using a different name. The following two code samples have the same effect:
|
|
187
236
|
#
|
|
@@ -193,12 +242,27 @@ module SingleForwardable
|
|
|
193
242
|
#
|
|
194
243
|
def def_single_delegators: (Symbol | String accessor, *Symbol methods) -> void
|
|
195
244
|
|
|
245
|
+
# <!--
|
|
246
|
+
# rdoc-file=lib/forwardable.rb
|
|
247
|
+
# - def_delegators(accessor, *methods)
|
|
248
|
+
# -->
|
|
249
|
+
#
|
|
196
250
|
alias def_delegators def_single_delegators
|
|
197
251
|
|
|
252
|
+
# <!--
|
|
253
|
+
# rdoc-file=lib/forwardable.rb
|
|
254
|
+
# - def_single_delegator(accessor, method, new_name=method)
|
|
255
|
+
# -->
|
|
198
256
|
# Defines a method *method* which delegates to *accessor* (i.e. it calls the
|
|
199
257
|
# method of the same name in *accessor*). If *new_name* is provided, it is used
|
|
200
258
|
# as the name for the delegate method. Returns the name of the method defined.
|
|
259
|
+
#
|
|
201
260
|
def def_single_delegator: (Symbol | String accessor, Symbol method, ?Symbol ali) -> void
|
|
202
261
|
|
|
262
|
+
# <!--
|
|
263
|
+
# rdoc-file=lib/forwardable.rb
|
|
264
|
+
# - def_delegator(accessor, method, ali = method)
|
|
265
|
+
# -->
|
|
266
|
+
#
|
|
203
267
|
alias def_delegator def_single_delegator
|
|
204
268
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
1
2
|
class IO
|
|
2
3
|
class ConsoleMode
|
|
3
4
|
def echo=: (bool) -> bool
|
|
@@ -5,100 +6,276 @@ class IO
|
|
|
5
6
|
def raw!: (?min: int, ?time: int, ?intr: bool) -> self
|
|
6
7
|
end
|
|
7
8
|
|
|
9
|
+
# <!--
|
|
10
|
+
# rdoc-file=ext/io/console/console.c
|
|
11
|
+
# - IO.console -> #<File:/dev/tty>
|
|
12
|
+
# - IO.console(sym, *args)
|
|
13
|
+
# -->
|
|
8
14
|
# Returns an File instance opened console.
|
|
9
15
|
#
|
|
10
16
|
# If `sym` is given, it will be sent to the opened console with `args` and the
|
|
11
17
|
# result will be returned instead of the console IO itself.
|
|
18
|
+
#
|
|
19
|
+
# You must require 'io/console' to use this method.
|
|
20
|
+
#
|
|
12
21
|
def self.console: () -> File?
|
|
13
22
|
| (:close) -> nil
|
|
14
23
|
| (Symbol sym, *untyped args) -> untyped
|
|
15
24
|
|
|
16
|
-
#
|
|
25
|
+
# <!--
|
|
26
|
+
# rdoc-file=ext/io/console/lib/console/size.rb
|
|
27
|
+
# - console_size()
|
|
28
|
+
# -->
|
|
17
29
|
#
|
|
18
|
-
|
|
19
|
-
def self.console_size: () -> [Integer, Integer]
|
|
30
|
+
def self.console_size: () -> [ Integer, Integer ]
|
|
20
31
|
|
|
32
|
+
# <!--
|
|
33
|
+
# rdoc-file=ext/io/console/lib/console/size.rb
|
|
34
|
+
# - default_console_size()
|
|
35
|
+
# -->
|
|
21
36
|
# fallback to console window size
|
|
22
37
|
#
|
|
23
|
-
|
|
24
|
-
def self.default_console_size: -> [Integer, Integer]
|
|
38
|
+
def self.default_console_size: () -> [ Integer, Integer ]
|
|
25
39
|
|
|
40
|
+
# <!--
|
|
41
|
+
# rdoc-file=ext/io/console/console.c
|
|
42
|
+
# - beep()
|
|
43
|
+
# -->
|
|
44
|
+
#
|
|
26
45
|
def beep: () -> self
|
|
27
46
|
|
|
47
|
+
# <!--
|
|
48
|
+
# rdoc-file=ext/io/console/console.c
|
|
49
|
+
# - check_winsize_changed()
|
|
50
|
+
# -->
|
|
51
|
+
#
|
|
28
52
|
def check_winsize_changed: () { () -> void } -> self
|
|
53
|
+
|
|
54
|
+
# <!--
|
|
55
|
+
# rdoc-file=ext/io/console/console.c
|
|
56
|
+
# - clear_screen()
|
|
57
|
+
# -->
|
|
58
|
+
#
|
|
29
59
|
def clear_screen: () -> self
|
|
30
60
|
|
|
61
|
+
# <!--
|
|
62
|
+
# rdoc-file=ext/io/console/console.c
|
|
63
|
+
# - io.console_mode -> mode
|
|
64
|
+
# -->
|
|
31
65
|
# Returns a data represents the current console mode.
|
|
66
|
+
#
|
|
67
|
+
# You must require 'io/console' to use this method.
|
|
68
|
+
#
|
|
32
69
|
def console_mode: () -> IO::ConsoleMode
|
|
33
70
|
|
|
71
|
+
# <!--
|
|
72
|
+
# rdoc-file=ext/io/console/console.c
|
|
73
|
+
# - io.console_mode = mode
|
|
74
|
+
# -->
|
|
34
75
|
# Sets the console mode to `mode`.
|
|
76
|
+
#
|
|
77
|
+
# You must require 'io/console' to use this method.
|
|
78
|
+
#
|
|
35
79
|
def console_mode=: (IO::ConsoleMode mode) -> IO::ConsoleMode
|
|
36
80
|
|
|
81
|
+
# <!--
|
|
82
|
+
# rdoc-file=ext/io/console/console.c
|
|
83
|
+
# - io.cooked {|io| }
|
|
84
|
+
# -->
|
|
37
85
|
# Yields `self` within cooked mode.
|
|
38
86
|
#
|
|
39
87
|
# STDIN.cooked(&:gets)
|
|
40
88
|
#
|
|
41
89
|
# will read and return a line with echo back and line editing.
|
|
90
|
+
#
|
|
91
|
+
# You must require 'io/console' to use this method.
|
|
92
|
+
#
|
|
42
93
|
def cooked: [T] () { (self) -> T } -> T
|
|
43
94
|
|
|
95
|
+
# <!--
|
|
96
|
+
# rdoc-file=ext/io/console/console.c
|
|
97
|
+
# - io.cooked!
|
|
98
|
+
# -->
|
|
44
99
|
# Enables cooked mode.
|
|
45
100
|
#
|
|
46
101
|
# If the terminal mode needs to be back, use io.cooked { ... }.
|
|
102
|
+
#
|
|
103
|
+
# You must require 'io/console' to use this method.
|
|
104
|
+
#
|
|
47
105
|
def cooked!: () -> self
|
|
48
106
|
|
|
49
|
-
|
|
50
|
-
|
|
107
|
+
# <!--
|
|
108
|
+
# rdoc-file=ext/io/console/console.c
|
|
109
|
+
# - cursor()
|
|
110
|
+
# -->
|
|
111
|
+
#
|
|
112
|
+
def cursor: () -> [ Integer, Integer ]
|
|
51
113
|
|
|
114
|
+
# <!--
|
|
115
|
+
# rdoc-file=ext/io/console/console.c
|
|
116
|
+
# - cursor=(p1)
|
|
117
|
+
# -->
|
|
118
|
+
#
|
|
119
|
+
def cursor=: ([ Integer, Integer ]) -> [ Integer, Integer ]
|
|
120
|
+
|
|
121
|
+
# <!--
|
|
122
|
+
# rdoc-file=ext/io/console/console.c
|
|
123
|
+
# - cursor_down(p1)
|
|
124
|
+
# -->
|
|
125
|
+
#
|
|
52
126
|
def cursor_down: (int) -> self
|
|
127
|
+
|
|
128
|
+
# <!--
|
|
129
|
+
# rdoc-file=ext/io/console/console.c
|
|
130
|
+
# - cursor_left(p1)
|
|
131
|
+
# -->
|
|
132
|
+
#
|
|
53
133
|
def cursor_left: (int) -> self
|
|
134
|
+
|
|
135
|
+
# <!--
|
|
136
|
+
# rdoc-file=ext/io/console/console.c
|
|
137
|
+
# - cursor_right(p1)
|
|
138
|
+
# -->
|
|
139
|
+
#
|
|
54
140
|
def cursor_right: (int) -> self
|
|
141
|
+
|
|
142
|
+
# <!--
|
|
143
|
+
# rdoc-file=ext/io/console/console.c
|
|
144
|
+
# - cursor_up(p1)
|
|
145
|
+
# -->
|
|
146
|
+
#
|
|
55
147
|
def cursor_up: (int) -> self
|
|
56
148
|
|
|
149
|
+
# <!--
|
|
150
|
+
# rdoc-file=ext/io/console/console.c
|
|
151
|
+
# - io.echo = flag
|
|
152
|
+
# -->
|
|
57
153
|
# Enables/disables echo back. On some platforms, all combinations of this flags
|
|
58
154
|
# and raw/cooked mode may not be valid.
|
|
155
|
+
#
|
|
156
|
+
# You must require 'io/console' to use this method.
|
|
157
|
+
#
|
|
59
158
|
def echo=: (bool flag) -> bool
|
|
60
159
|
|
|
160
|
+
# <!--
|
|
161
|
+
# rdoc-file=ext/io/console/console.c
|
|
162
|
+
# - io.echo? -> true or false
|
|
163
|
+
# -->
|
|
61
164
|
# Returns `true` if echo back is enabled.
|
|
165
|
+
#
|
|
166
|
+
# You must require 'io/console' to use this method.
|
|
167
|
+
#
|
|
62
168
|
def echo?: () -> bool
|
|
63
169
|
|
|
170
|
+
# <!--
|
|
171
|
+
# rdoc-file=ext/io/console/console.c
|
|
172
|
+
# - erase_line(p1)
|
|
173
|
+
# -->
|
|
174
|
+
#
|
|
64
175
|
def erase_line: (0 | 1 | 2 | nil) -> self
|
|
176
|
+
|
|
177
|
+
# <!--
|
|
178
|
+
# rdoc-file=ext/io/console/console.c
|
|
179
|
+
# - erase_screen(p1)
|
|
180
|
+
# -->
|
|
181
|
+
#
|
|
65
182
|
def erase_screen: (0 | 1 | 2 | 3 | nil) -> self
|
|
66
183
|
|
|
184
|
+
# <!--
|
|
185
|
+
# rdoc-file=ext/io/console/console.c
|
|
186
|
+
# - io.getch(min: nil, time: nil, intr: nil) -> char
|
|
187
|
+
# -->
|
|
67
188
|
# Reads and returns a character in raw mode.
|
|
68
189
|
#
|
|
69
190
|
# See IO#raw for details on the parameters.
|
|
191
|
+
#
|
|
192
|
+
# You must require 'io/console' to use this method.
|
|
193
|
+
#
|
|
70
194
|
def getch: (?min: int, ?time: int, ?intr: bool) -> String
|
|
71
195
|
|
|
72
|
-
#
|
|
73
|
-
#
|
|
196
|
+
# <!--
|
|
197
|
+
# rdoc-file=ext/io/console/console.c
|
|
198
|
+
# - io.getpass(prompt=nil) -> string
|
|
199
|
+
# -->
|
|
200
|
+
# Reads and returns a line without echo back. Prints `prompt` unless it is
|
|
201
|
+
# `nil`.
|
|
202
|
+
#
|
|
203
|
+
# The newline character that terminates the read line is removed from the
|
|
204
|
+
# returned string, see String#chomp!.
|
|
205
|
+
#
|
|
206
|
+
# You must require 'io/console' to use this method.
|
|
74
207
|
#
|
|
75
|
-
# The newline character that terminates the
|
|
76
|
-
# read line is removed from the returned string,
|
|
77
|
-
# see String#chomp!.
|
|
78
208
|
def getpass: (?String) -> String
|
|
79
209
|
|
|
210
|
+
# <!--
|
|
211
|
+
# rdoc-file=ext/io/console/console.c
|
|
212
|
+
# - goto(p1, p2)
|
|
213
|
+
# -->
|
|
214
|
+
#
|
|
80
215
|
def goto: (int, int) -> self
|
|
81
216
|
|
|
217
|
+
# <!--
|
|
218
|
+
# rdoc-file=ext/io/console/console.c
|
|
219
|
+
# - goto_column(p1)
|
|
220
|
+
# -->
|
|
221
|
+
#
|
|
82
222
|
def goto_column: (int) -> self
|
|
83
223
|
|
|
224
|
+
# <!--
|
|
225
|
+
# rdoc-file=ext/io/console/console.c
|
|
226
|
+
# - io.iflush
|
|
227
|
+
# -->
|
|
84
228
|
# Flushes input buffer in kernel.
|
|
229
|
+
#
|
|
230
|
+
# You must require 'io/console' to use this method.
|
|
231
|
+
#
|
|
85
232
|
def iflush: () -> self
|
|
86
233
|
|
|
234
|
+
# <!--
|
|
235
|
+
# rdoc-file=ext/io/console/console.c
|
|
236
|
+
# - io.ioflush
|
|
237
|
+
# -->
|
|
87
238
|
# Flushes input and output buffers in kernel.
|
|
239
|
+
#
|
|
240
|
+
# You must require 'io/console' to use this method.
|
|
241
|
+
#
|
|
88
242
|
def ioflush: () -> self
|
|
89
243
|
|
|
244
|
+
# <!--
|
|
245
|
+
# rdoc-file=ext/io/console/console.c
|
|
246
|
+
# - io.noecho {|io| }
|
|
247
|
+
# -->
|
|
90
248
|
# Yields `self` with disabling echo back.
|
|
91
249
|
#
|
|
92
250
|
# STDIN.noecho(&:gets)
|
|
93
251
|
#
|
|
94
252
|
# will read and return a line without echo back.
|
|
253
|
+
#
|
|
254
|
+
# You must require 'io/console' to use this method.
|
|
255
|
+
#
|
|
95
256
|
def noecho: [T] () { (self) -> T } -> T
|
|
96
257
|
|
|
258
|
+
# <!--
|
|
259
|
+
# rdoc-file=ext/io/console/console.c
|
|
260
|
+
# - io.oflush
|
|
261
|
+
# -->
|
|
97
262
|
# Flushes output buffer in kernel.
|
|
263
|
+
#
|
|
264
|
+
# You must require 'io/console' to use this method.
|
|
265
|
+
#
|
|
98
266
|
def oflush: () -> self
|
|
99
267
|
|
|
268
|
+
# <!--
|
|
269
|
+
# rdoc-file=ext/io/console/console.c
|
|
270
|
+
# - pressed?(p1)
|
|
271
|
+
# -->
|
|
272
|
+
#
|
|
100
273
|
def pressed?: (Integer | Symbol | String) -> bool
|
|
101
274
|
|
|
275
|
+
# <!--
|
|
276
|
+
# rdoc-file=ext/io/console/console.c
|
|
277
|
+
# - io.raw(min: nil, time: nil, intr: nil) {|io| }
|
|
278
|
+
# -->
|
|
102
279
|
# Yields `self` within raw mode, and returns the result of the block.
|
|
103
280
|
#
|
|
104
281
|
# STDIN.raw(&:gets)
|
|
@@ -115,23 +292,58 @@ class IO
|
|
|
115
292
|
# special characters.
|
|
116
293
|
#
|
|
117
294
|
# Refer to the manual page of termios for further details.
|
|
295
|
+
#
|
|
296
|
+
# You must require 'io/console' to use this method.
|
|
297
|
+
#
|
|
118
298
|
def raw: [T] (?min: int, ?time: int, ?intr: bool) { (self) -> T } -> T
|
|
119
299
|
|
|
300
|
+
# <!--
|
|
301
|
+
# rdoc-file=ext/io/console/console.c
|
|
302
|
+
# - io.raw!(min: nil, time: nil, intr: nil) -> io
|
|
303
|
+
# -->
|
|
120
304
|
# Enables raw mode, and returns `io`.
|
|
121
305
|
#
|
|
122
306
|
# If the terminal mode needs to be back, use `io.raw { ... }`.
|
|
123
307
|
#
|
|
124
308
|
# See IO#raw for details on the parameters.
|
|
309
|
+
#
|
|
310
|
+
# You must require 'io/console' to use this method.
|
|
311
|
+
#
|
|
125
312
|
def raw!: (?min: int, ?time: int, ?intr: bool) -> self
|
|
126
313
|
|
|
314
|
+
# <!--
|
|
315
|
+
# rdoc-file=ext/io/console/console.c
|
|
316
|
+
# - scroll_backward(p1)
|
|
317
|
+
# -->
|
|
318
|
+
#
|
|
127
319
|
def scroll_backward: (int) -> self
|
|
320
|
+
|
|
321
|
+
# <!--
|
|
322
|
+
# rdoc-file=ext/io/console/console.c
|
|
323
|
+
# - scroll_forward(p1)
|
|
324
|
+
# -->
|
|
325
|
+
#
|
|
128
326
|
def scroll_forward: (int) -> self
|
|
129
327
|
|
|
328
|
+
# <!--
|
|
329
|
+
# rdoc-file=ext/io/console/console.c
|
|
330
|
+
# - io.winsize -> [rows, columns]
|
|
331
|
+
# -->
|
|
130
332
|
# Returns console size.
|
|
131
|
-
|
|
333
|
+
#
|
|
334
|
+
# You must require 'io/console' to use this method.
|
|
335
|
+
#
|
|
336
|
+
def winsize: () -> [ Integer, Integer ]
|
|
132
337
|
|
|
338
|
+
# <!--
|
|
339
|
+
# rdoc-file=ext/io/console/console.c
|
|
340
|
+
# - io.winsize = [rows, columns]
|
|
341
|
+
# -->
|
|
133
342
|
# Tries to set console size. The effect depends on the platform and the running
|
|
134
343
|
# environment.
|
|
135
|
-
|
|
136
|
-
|
|
344
|
+
#
|
|
345
|
+
# You must require 'io/console' to use this method.
|
|
346
|
+
#
|
|
347
|
+
def winsize=: ([ Integer, Integer ]) -> [ Integer, Integer ]
|
|
348
|
+
| ([ Integer, Integer, Integer, Integer ]) -> [ Integer, Integer, Integer, Integer ]
|
|
137
349
|
end
|