steep 0.15.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +0 -3
- data/CHANGELOG.md +25 -0
- data/Rakefile +0 -13
- data/bin/setup +0 -2
- data/bin/smoke_runner.rb +0 -1
- data/exe/steep +0 -1
- data/lib/steep.rb +12 -1
- data/lib/steep/cli.rb +16 -1
- data/lib/steep/drivers/annotations.rb +1 -1
- data/lib/steep/drivers/check.rb +1 -12
- data/lib/steep/drivers/langserver.rb +13 -462
- data/lib/steep/drivers/utils/driver_helper.rb +1 -1
- data/lib/steep/drivers/watch.rb +97 -85
- data/lib/steep/drivers/worker.rb +51 -0
- data/lib/steep/project.rb +9 -5
- data/lib/steep/project/completion_provider.rb +4 -2
- data/lib/steep/project/file.rb +2 -1
- data/lib/steep/project/hover_content.rb +6 -3
- data/lib/steep/project/options.rb +15 -0
- data/lib/steep/project/target.rb +30 -20
- data/lib/steep/server/base_worker.rb +56 -0
- data/lib/steep/server/code_worker.rb +151 -0
- data/lib/steep/server/interaction_worker.rb +281 -0
- data/lib/steep/server/master.rb +196 -0
- data/lib/steep/server/signature_worker.rb +148 -0
- data/lib/steep/server/utils.rb +36 -0
- data/lib/steep/server/worker_process.rb +62 -0
- data/lib/steep/signature/validator.rb +5 -5
- data/lib/steep/type_construction.rb +13 -19
- data/lib/steep/type_inference/constant_env.rb +2 -10
- data/lib/steep/type_inference/context.rb +1 -0
- data/lib/steep/version.rb +1 -1
- data/steep.gemspec +7 -8
- metadata +22 -142
- data/exe/rbs +0 -3
- data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
- data/vendor/ruby-signature/.gitignore +0 -12
- data/vendor/ruby-signature/.rubocop.yml +0 -15
- data/vendor/ruby-signature/BSDL +0 -22
- data/vendor/ruby-signature/COPYING +0 -56
- data/vendor/ruby-signature/Gemfile +0 -6
- data/vendor/ruby-signature/README.md +0 -93
- data/vendor/ruby-signature/Rakefile +0 -67
- data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
- data/vendor/ruby-signature/bin/console +0 -14
- data/vendor/ruby-signature/bin/query-rdoc +0 -103
- data/vendor/ruby-signature/bin/setup +0 -10
- data/vendor/ruby-signature/bin/sort +0 -89
- data/vendor/ruby-signature/bin/test_runner.rb +0 -16
- data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
- data/vendor/ruby-signature/docs/sigs.md +0 -148
- data/vendor/ruby-signature/docs/stdlib.md +0 -152
- data/vendor/ruby-signature/docs/syntax.md +0 -528
- data/vendor/ruby-signature/exe/rbs +0 -7
- data/vendor/ruby-signature/lib/rbs.rb +0 -64
- data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
- data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
- data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
- data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
- data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
- data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
- data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
- data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
- data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
- data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
- data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
- data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
- data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
- data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
- data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
- data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
- data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
- data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
- data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
- data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
- data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
- data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
- data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
- data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
- data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
- data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
- data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
- data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
- data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
- data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
- data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
- data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
- data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
- data/vendor/ruby-signature/rbs.gemspec +0 -45
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
- data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
- data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
- data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
- data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
- data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -44
- data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
- data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
- data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
- data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
- data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
- data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
- data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
- data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
- data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
- data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
- data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
- data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
- data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
- data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
- data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
- data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
- data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
- data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
- data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
- data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
- data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
- data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
- data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
- data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
- data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
- data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
- data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
- data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
- data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
- data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
- data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
- data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
- data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
- data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
- data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
- data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
- data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,683 +0,0 @@
|
|
1
|
-
# The [IO](IO) class is the basis for all input and
|
2
|
-
# output in Ruby. An I/O stream may be *duplexed* (that is,
|
3
|
-
# bidirectional), and so may use more than one native operating system
|
4
|
-
# stream.
|
5
|
-
#
|
6
|
-
# Many of the examples in this section use the
|
7
|
-
# [File](https://ruby-doc.org/core-2.6.3/File.html) class, the only
|
8
|
-
# standard subclass of [IO](IO). The two classes are
|
9
|
-
# closely associated. Like the
|
10
|
-
# [File](https://ruby-doc.org/core-2.6.3/File.html) class, the Socket
|
11
|
-
# library subclasses from [IO](IO) (such as TCPSocket
|
12
|
-
# or UDPSocket).
|
13
|
-
#
|
14
|
-
# The
|
15
|
-
# [Kernel\#open](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-open)
|
16
|
-
# method can create an [IO](IO) (or
|
17
|
-
# [File](https://ruby-doc.org/core-2.6.3/File.html) ) object for these
|
18
|
-
# types of arguments:
|
19
|
-
#
|
20
|
-
# - A plain string represents a filename suitable for the underlying
|
21
|
-
# operating system.
|
22
|
-
#
|
23
|
-
# - A string starting with `"|"` indicates a subprocess. The remainder
|
24
|
-
# of the string following the `"|"` is invoked as a process with
|
25
|
-
# appropriate input/output channels connected to it.
|
26
|
-
#
|
27
|
-
# - A string equal to `"|-"` will create another Ruby instance as a
|
28
|
-
# subprocess.
|
29
|
-
#
|
30
|
-
# The [IO](IO) may be opened with different file modes
|
31
|
-
# (read-only, write-only) and encodings for proper conversion. See
|
32
|
-
# [::new](IO#method-c-new) for these options. See
|
33
|
-
# [Kernel\#open](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-open)
|
34
|
-
# for details of the various command formats described above.
|
35
|
-
#
|
36
|
-
# [::popen](IO#method-c-popen), the Open3 library, or
|
37
|
-
# Process\#spawn may also be used to communicate with subprocesses through
|
38
|
-
# an [IO](IO).
|
39
|
-
#
|
40
|
-
# Ruby will convert pathnames between different operating system
|
41
|
-
# conventions if possible. For instance, on a Windows system the filename
|
42
|
-
# `"/gumby/ruby/test.rb"` will be opened as `"\gumby\ruby\test.rb"` . When
|
43
|
-
# specifying a Windows-style filename in a Ruby string, remember to escape
|
44
|
-
# the backslashes:
|
45
|
-
#
|
46
|
-
# ```ruby
|
47
|
-
# "C:\\gumby\\ruby\\test.rb"
|
48
|
-
# ```
|
49
|
-
#
|
50
|
-
# Our examples here will use the Unix-style forward slashes;
|
51
|
-
# File::ALT\_SEPARATOR can be used to get the platform-specific separator
|
52
|
-
# character.
|
53
|
-
#
|
54
|
-
# The global constant [ARGF](https://ruby-doc.org/core-2.6.3/ARGF.html)
|
55
|
-
# (also accessible as `$<` ) provides an IO-like stream which allows
|
56
|
-
# access to all files mentioned on the command line (or STDIN if no files
|
57
|
-
# are mentioned).
|
58
|
-
# [ARGF\#path](https://ruby-doc.org/core-2.6.3/ARGF.html#method-i-path)
|
59
|
-
# and its alias
|
60
|
-
# [ARGF\#filename](https://ruby-doc.org/core-2.6.3/ARGF.html#method-i-filename)
|
61
|
-
# are provided to access the name of the file currently being read.
|
62
|
-
#
|
63
|
-
#
|
64
|
-
# The io/console extension provides methods for interacting with the
|
65
|
-
# console. The console can be accessed from IO.console or the standard
|
66
|
-
# input/output/error [IO](IO) objects.
|
67
|
-
#
|
68
|
-
# Requiring io/console adds the following methods:
|
69
|
-
#
|
70
|
-
# - IO::console
|
71
|
-
#
|
72
|
-
# - IO\#raw
|
73
|
-
#
|
74
|
-
# - IO\#raw\!
|
75
|
-
#
|
76
|
-
# - IO\#cooked
|
77
|
-
#
|
78
|
-
# - IO\#cooked\!
|
79
|
-
#
|
80
|
-
# - IO\#getch
|
81
|
-
#
|
82
|
-
# - IO\#echo=
|
83
|
-
#
|
84
|
-
# - IO\#echo?
|
85
|
-
#
|
86
|
-
# - IO\#noecho
|
87
|
-
#
|
88
|
-
# - IO\#winsize
|
89
|
-
#
|
90
|
-
# - IO\#winsize=
|
91
|
-
#
|
92
|
-
# - IO\#iflush
|
93
|
-
#
|
94
|
-
# - IO\#ioflush
|
95
|
-
#
|
96
|
-
# - IO\#oflush
|
97
|
-
#
|
98
|
-
# Example:
|
99
|
-
#
|
100
|
-
# ```ruby
|
101
|
-
# require 'io/console'
|
102
|
-
# rows, columns = $stdout.winsize
|
103
|
-
# puts "Your screen is #{columns} wide and #{rows} tall"
|
104
|
-
# ```
|
105
|
-
class IO < Object
|
106
|
-
include File::Constants
|
107
|
-
|
108
|
-
include Enumerable[String, IO]
|
109
|
-
|
110
|
-
def <<: (untyped arg0) -> self
|
111
|
-
|
112
|
-
def advise: (Symbol arg0, ?Integer offset, ?Integer len) -> NilClass
|
113
|
-
|
114
|
-
def autoclose=: (bool arg0) -> bool
|
115
|
-
|
116
|
-
# Returns `true` if the underlying file descriptor of *ios* will be closed
|
117
|
-
# automatically at its finalization, otherwise `false` .
|
118
|
-
def autoclose?: () -> bool
|
119
|
-
|
120
|
-
# Puts *ios* into binary mode. Once a stream is in binary mode, it cannot
|
121
|
-
# be reset to nonbinary mode.
|
122
|
-
#
|
123
|
-
# - newline conversion disabled
|
124
|
-
#
|
125
|
-
# - encoding conversion disabled
|
126
|
-
#
|
127
|
-
# - content is treated as ASCII-8BIT
|
128
|
-
def binmode: () -> self
|
129
|
-
|
130
|
-
# Returns `true` if *ios* is binmode.
|
131
|
-
def binmode?: () -> bool
|
132
|
-
|
133
|
-
# Closes *ios* and flushes any pending writes to the operating system. The
|
134
|
-
# stream is unavailable for any further data operations; an `IOError` is
|
135
|
-
# raised if such an attempt is made. I/O streams are automatically closed
|
136
|
-
# when they are claimed by the garbage collector.
|
137
|
-
#
|
138
|
-
# If *ios* is opened by `IO.popen`, `close` sets `$?` .
|
139
|
-
#
|
140
|
-
# Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
|
141
|
-
# just ignored since Ruby 2.3.
|
142
|
-
def close: () -> NilClass
|
143
|
-
|
144
|
-
def close_on_exec=: (bool arg0) -> bool
|
145
|
-
|
146
|
-
# Returns `true` if *ios* will be closed on exec.
|
147
|
-
#
|
148
|
-
# ```ruby
|
149
|
-
# f = open("/dev/null")
|
150
|
-
# f.close_on_exec? #=> false
|
151
|
-
# f.close_on_exec = true
|
152
|
-
# f.close_on_exec? #=> true
|
153
|
-
# f.close_on_exec = false
|
154
|
-
# f.close_on_exec? #=> false
|
155
|
-
# ```
|
156
|
-
def close_on_exec?: () -> bool
|
157
|
-
|
158
|
-
# Closes the read end of a duplex I/O stream (i.e., one that contains both
|
159
|
-
# a read and a write stream, such as a pipe). Will raise an `IOError` if
|
160
|
-
# the stream is not duplexed.
|
161
|
-
#
|
162
|
-
# ```ruby
|
163
|
-
# f = IO.popen("/bin/sh","r+")
|
164
|
-
# f.close_read
|
165
|
-
# f.readlines
|
166
|
-
# ```
|
167
|
-
#
|
168
|
-
# *produces:*
|
169
|
-
#
|
170
|
-
# prog.rb:3:in `readlines': not opened for reading (IOError)
|
171
|
-
# from prog.rb:3
|
172
|
-
#
|
173
|
-
# Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
|
174
|
-
# just ignored since Ruby 2.3.
|
175
|
-
def close_read: () -> NilClass
|
176
|
-
|
177
|
-
# Closes the write end of a duplex I/O stream (i.e., one that contains
|
178
|
-
# both a read and a write stream, such as a pipe). Will raise an `IOError`
|
179
|
-
# if the stream is not duplexed.
|
180
|
-
#
|
181
|
-
# ```ruby
|
182
|
-
# f = IO.popen("/bin/sh","r+")
|
183
|
-
# f.close_write
|
184
|
-
# f.print "nowhere"
|
185
|
-
# ```
|
186
|
-
#
|
187
|
-
# *produces:*
|
188
|
-
#
|
189
|
-
# prog.rb:3:in `write': not opened for writing (IOError)
|
190
|
-
# from prog.rb:3:in `print'
|
191
|
-
# from prog.rb:3
|
192
|
-
#
|
193
|
-
# Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
|
194
|
-
# just ignored since Ruby 2.3.
|
195
|
-
def close_write: () -> NilClass
|
196
|
-
|
197
|
-
# Returns `true` if *ios* is completely closed (for duplex streams, both
|
198
|
-
# reader and writer), `false` otherwise.
|
199
|
-
#
|
200
|
-
# ```ruby
|
201
|
-
# f = File.new("testfile")
|
202
|
-
# f.close #=> nil
|
203
|
-
# f.closed? #=> true
|
204
|
-
# f = IO.popen("/bin/sh","r+")
|
205
|
-
# f.close_write #=> nil
|
206
|
-
# f.closed? #=> false
|
207
|
-
# f.close_read #=> nil
|
208
|
-
# f.closed? #=> true
|
209
|
-
# ```
|
210
|
-
def closed?: () -> bool
|
211
|
-
|
212
|
-
def each: (?String sep, ?Integer limit) { (String arg0) -> untyped } -> self
|
213
|
-
| (?String sep, ?Integer limit) -> ::Enumerator[String, self]
|
214
|
-
|
215
|
-
def each_byte: () { (Integer arg0) -> untyped } -> self
|
216
|
-
| () -> ::Enumerator[Integer, self]
|
217
|
-
|
218
|
-
def each_char: () { (String arg0) -> untyped } -> self
|
219
|
-
| () -> ::Enumerator[String, self]
|
220
|
-
|
221
|
-
def each_codepoint: () { (Integer arg0) -> untyped } -> self
|
222
|
-
| () -> ::Enumerator[Integer, self]
|
223
|
-
|
224
|
-
# Returns true if *ios* is at end of file that means there are no more
|
225
|
-
# data to read. The stream must be opened for reading or an `IOError` will
|
226
|
-
# be raised.
|
227
|
-
#
|
228
|
-
# ```ruby
|
229
|
-
# f = File.new("testfile")
|
230
|
-
# dummy = f.readlines
|
231
|
-
# f.eof #=> true
|
232
|
-
# ```
|
233
|
-
#
|
234
|
-
# If *ios* is a stream such as pipe or socket, `IO#eof?` blocks until the
|
235
|
-
# other end sends some data or closes it.
|
236
|
-
#
|
237
|
-
# ```ruby
|
238
|
-
# r, w = IO.pipe
|
239
|
-
# Thread.new { sleep 1; w.close }
|
240
|
-
# r.eof? #=> true after 1 second blocking
|
241
|
-
#
|
242
|
-
# r, w = IO.pipe
|
243
|
-
# Thread.new { sleep 1; w.puts "a" }
|
244
|
-
# r.eof? #=> false after 1 second blocking
|
245
|
-
#
|
246
|
-
# r, w = IO.pipe
|
247
|
-
# r.eof? # blocks forever
|
248
|
-
# ```
|
249
|
-
#
|
250
|
-
# Note that `IO#eof?` reads data to the input byte buffer. So `IO#sysread`
|
251
|
-
# may not behave as you intend with `IO#eof?`, unless you call
|
252
|
-
# `IO#rewind` first (which is not available for some streams).
|
253
|
-
def eof: () -> bool
|
254
|
-
|
255
|
-
def fcntl: (Integer integer_cmd, String | Integer arg) -> Integer
|
256
|
-
|
257
|
-
# Immediately writes all buffered data in *ios* to disk.
|
258
|
-
#
|
259
|
-
# If the underlying operating system does not support *fdatasync(2)* ,
|
260
|
-
# `IO#fsync` is called instead (which might raise a `NotImplementedError`
|
261
|
-
# ).
|
262
|
-
def fdatasync: () -> Integer?
|
263
|
-
|
264
|
-
# Returns an integer representing the numeric file descriptor for *ios* .
|
265
|
-
#
|
266
|
-
# ```ruby
|
267
|
-
# $stdin.fileno #=> 0
|
268
|
-
# $stdout.fileno #=> 1
|
269
|
-
# ```
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
# Also aliased as: [to\_i](IO.downloaded.ruby_doc#method-i-to_i)
|
274
|
-
def fileno: () -> Integer
|
275
|
-
|
276
|
-
# Flushes any buffered data within *ios* to the underlying operating
|
277
|
-
# system (note that this is Ruby internal buffering only; the OS may
|
278
|
-
# buffer the data as well).
|
279
|
-
#
|
280
|
-
# ```ruby
|
281
|
-
# $stdout.print "no newline"
|
282
|
-
# $stdout.flush
|
283
|
-
# ```
|
284
|
-
#
|
285
|
-
# *produces:*
|
286
|
-
#
|
287
|
-
# ```ruby
|
288
|
-
# no newline
|
289
|
-
# ```
|
290
|
-
def flush: () -> self
|
291
|
-
|
292
|
-
# Immediately writes all buffered data in *ios* to disk. Note that `fsync`
|
293
|
-
# differs from using `IO#sync=` . The latter ensures that data is flushed
|
294
|
-
# from Ruby’s buffers, but does not guarantee that the underlying
|
295
|
-
# operating system actually writes it to disk.
|
296
|
-
#
|
297
|
-
# `NotImplementedError` is raised if the underlying operating system does
|
298
|
-
# not support *fsync(2)* .
|
299
|
-
def fsync: () -> Integer?
|
300
|
-
|
301
|
-
# Gets the next 8-bit byte (0..255) from *ios* . Returns `nil` if called
|
302
|
-
# at end of file.
|
303
|
-
#
|
304
|
-
# ```ruby
|
305
|
-
# f = File.new("testfile")
|
306
|
-
# f.getbyte #=> 84
|
307
|
-
# f.getbyte #=> 104
|
308
|
-
# ```
|
309
|
-
def getbyte: () -> Integer?
|
310
|
-
|
311
|
-
# Reads a one-character string from *ios* . Returns `nil` if called at end
|
312
|
-
# of file.
|
313
|
-
#
|
314
|
-
# ```ruby
|
315
|
-
# f = File.new("testfile")
|
316
|
-
# f.getc #=> "h"
|
317
|
-
# f.getc #=> "e"
|
318
|
-
# ```
|
319
|
-
def getc: () -> String?
|
320
|
-
|
321
|
-
def gets: (?String sep, ?Integer limit) -> String?
|
322
|
-
|
323
|
-
def initialize: (Integer fd, ?Integer mode, ?Integer opt) -> void
|
324
|
-
|
325
|
-
# Return a string describing this [IO](IO.downloaded.ruby_doc) object.
|
326
|
-
def inspect: () -> String
|
327
|
-
|
328
|
-
# Returns the [Encoding](https://ruby-doc.org/core-2.6.3/Encoding.html) of
|
329
|
-
# the internal string if conversion is specified. Otherwise returns `nil`
|
330
|
-
# .
|
331
|
-
def internal_encoding: () -> Encoding
|
332
|
-
|
333
|
-
def ioctl: (Integer integer_cmd, String | Integer arg) -> Integer
|
334
|
-
|
335
|
-
# Returns `true` if *ios* is associated with a terminal device (tty),
|
336
|
-
# `false` otherwise.
|
337
|
-
#
|
338
|
-
# ```ruby
|
339
|
-
# File.new("testfile").isatty #=> false
|
340
|
-
# File.new("/dev/tty").isatty #=> true
|
341
|
-
# ```
|
342
|
-
def isatty: () -> bool
|
343
|
-
|
344
|
-
# Returns the current line number in *ios* . The stream must be opened for
|
345
|
-
# reading. `lineno` counts the number of times
|
346
|
-
# [gets](IO.downloaded.ruby_doc#method-i-gets) is called rather than the
|
347
|
-
# number of newlines encountered. The two values will differ if
|
348
|
-
# [gets](IO.downloaded.ruby_doc#method-i-gets) is called with a separator
|
349
|
-
# other than newline.
|
350
|
-
#
|
351
|
-
# Methods that use `$/` like [each](IO.downloaded.ruby_doc#method-i-each)
|
352
|
-
# , [lines](IO.downloaded.ruby_doc#method-i-lines) and
|
353
|
-
# [readline](IO.downloaded.ruby_doc#method-i-readline) will also increment
|
354
|
-
# `lineno` .
|
355
|
-
#
|
356
|
-
# See also the `$.` variable.
|
357
|
-
#
|
358
|
-
# ```ruby
|
359
|
-
# f = File.new("testfile")
|
360
|
-
# f.lineno #=> 0
|
361
|
-
# f.gets #=> "This is line one\n"
|
362
|
-
# f.lineno #=> 1
|
363
|
-
# f.gets #=> "This is line two\n"
|
364
|
-
# f.lineno #=> 2
|
365
|
-
# ```
|
366
|
-
def lineno: () -> Integer
|
367
|
-
|
368
|
-
def lineno=: (Integer arg0) -> Integer
|
369
|
-
|
370
|
-
# Returns the process ID of a child process associated with *ios* . This
|
371
|
-
# will be set by `IO.popen` .
|
372
|
-
#
|
373
|
-
# ```ruby
|
374
|
-
# pipe = IO.popen("-")
|
375
|
-
# if pipe
|
376
|
-
# $stderr.puts "In parent, child pid is #{pipe.pid}"
|
377
|
-
# else
|
378
|
-
# $stderr.puts "In child, pid is #{$$}"
|
379
|
-
# end
|
380
|
-
# ```
|
381
|
-
#
|
382
|
-
# *produces:*
|
383
|
-
#
|
384
|
-
# In child, pid is 26209
|
385
|
-
# In parent, child pid is 26209
|
386
|
-
def pid: () -> Integer
|
387
|
-
|
388
|
-
# Returns the current offset (in bytes) of *ios* .
|
389
|
-
#
|
390
|
-
# ```ruby
|
391
|
-
# f = File.new("testfile")
|
392
|
-
# f.pos #=> 0
|
393
|
-
# f.gets #=> "This is line one\n"
|
394
|
-
# f.pos #=> 17
|
395
|
-
# ```
|
396
|
-
def pos: () -> Integer
|
397
|
-
|
398
|
-
def pos=: (Integer arg0) -> Integer
|
399
|
-
|
400
|
-
def print: (*untyped arg0) -> NilClass
|
401
|
-
|
402
|
-
def printf: (String format_string, *untyped arg0) -> NilClass
|
403
|
-
|
404
|
-
def putc: (Numeric | String arg0) -> untyped
|
405
|
-
|
406
|
-
def puts: (*untyped arg0) -> NilClass
|
407
|
-
|
408
|
-
def read: (?Integer length, ?String outbuf) -> String?
|
409
|
-
|
410
|
-
def read_nonblock: (Integer len) -> String
|
411
|
-
| (Integer len, ?String buf) -> String
|
412
|
-
|
413
|
-
# Reads a byte as with `IO#getbyte`, but raises an `EOFError` on end of
|
414
|
-
# file.
|
415
|
-
def readbyte: () -> Integer
|
416
|
-
|
417
|
-
# Reads a one-character string from *ios* . Raises an `EOFError` on end of
|
418
|
-
# file.
|
419
|
-
#
|
420
|
-
# ```ruby
|
421
|
-
# f = File.new("testfile")
|
422
|
-
# f.readchar #=> "h"
|
423
|
-
# f.readchar #=> "e"
|
424
|
-
# ```
|
425
|
-
def readchar: () -> String
|
426
|
-
|
427
|
-
def readline: (?String sep, ?Integer limit) -> String
|
428
|
-
|
429
|
-
def readlines: (?String sep, ?Integer limit) -> ::Array[String]
|
430
|
-
|
431
|
-
def readpartial: (Integer maxlen) -> String
|
432
|
-
| (Integer maxlen, ?String outbuf) -> String
|
433
|
-
|
434
|
-
def reopen: (IO other_IO_or_path) -> IO
|
435
|
-
| (String other_IO_or_path, ?String mode_str) -> IO
|
436
|
-
|
437
|
-
# Positions *ios* to the beginning of input, resetting `lineno` to zero.
|
438
|
-
#
|
439
|
-
# ```ruby
|
440
|
-
# f = File.new("testfile")
|
441
|
-
# f.readline #=> "This is line one\n"
|
442
|
-
# f.rewind #=> 0
|
443
|
-
# f.lineno #=> 0
|
444
|
-
# f.readline #=> "This is line one\n"
|
445
|
-
# ```
|
446
|
-
#
|
447
|
-
# Note that it cannot be used with streams such as pipes, ttys, and
|
448
|
-
# sockets.
|
449
|
-
def rewind: () -> Integer
|
450
|
-
|
451
|
-
def seek: (Integer amount, ?Integer whence) -> Integer
|
452
|
-
|
453
|
-
def set_encoding: (?String | Encoding ext_or_ext_int_enc) -> self
|
454
|
-
| (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc) -> self
|
455
|
-
|
456
|
-
# Returns status information for *ios* as an object of type `File::Stat` .
|
457
|
-
#
|
458
|
-
# ```ruby
|
459
|
-
# f = File.new("testfile")
|
460
|
-
# s = f.stat
|
461
|
-
# "%o" % s.mode #=> "100644"
|
462
|
-
# s.blksize #=> 4096
|
463
|
-
# s.atime #=> Wed Apr 09 08:53:54 CDT 2003
|
464
|
-
# ```
|
465
|
-
def stat: () -> File::Stat
|
466
|
-
|
467
|
-
# Returns the current “sync mode” of *ios* . When sync mode is true, all
|
468
|
-
# output is immediately flushed to the underlying operating system and is
|
469
|
-
# not buffered by Ruby internally. See also `IO#fsync` .
|
470
|
-
#
|
471
|
-
# ```ruby
|
472
|
-
# f = File.new("testfile")
|
473
|
-
# f.sync #=> false
|
474
|
-
# ```
|
475
|
-
def sync: () -> bool
|
476
|
-
|
477
|
-
def sync=: (bool arg0) -> bool
|
478
|
-
|
479
|
-
def sysread: (Integer maxlen, String outbuf) -> String
|
480
|
-
|
481
|
-
def sysseek: (Integer amount, ?Integer whence) -> Integer
|
482
|
-
|
483
|
-
def syswrite: (String arg0) -> Integer
|
484
|
-
|
485
|
-
# Returns the current offset (in bytes) of *ios* .
|
486
|
-
#
|
487
|
-
# ```ruby
|
488
|
-
# f = File.new("testfile")
|
489
|
-
# f.pos #=> 0
|
490
|
-
# f.gets #=> "This is line one\n"
|
491
|
-
# f.pos #=> 17
|
492
|
-
# ```
|
493
|
-
def tell: () -> Integer
|
494
|
-
|
495
|
-
# Returns *ios* .
|
496
|
-
def to_io: () -> self
|
497
|
-
|
498
|
-
# Returns `true` if *ios* is associated with a terminal device (tty),
|
499
|
-
# `false` otherwise.
|
500
|
-
#
|
501
|
-
# ```ruby
|
502
|
-
# File.new("testfile").isatty #=> false
|
503
|
-
# File.new("/dev/tty").isatty #=> true
|
504
|
-
# ```
|
505
|
-
def tty?: () -> bool
|
506
|
-
|
507
|
-
def ungetbyte: (String | Integer arg0) -> NilClass
|
508
|
-
|
509
|
-
def ungetc: (String arg0) -> NilClass
|
510
|
-
|
511
|
-
def write: (String arg0) -> Integer
|
512
|
-
|
513
|
-
def self.binread: (String name, ?Integer length, ?Integer offset) -> String
|
514
|
-
|
515
|
-
def self.binwrite: (String name, String arg0, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> Integer
|
516
|
-
|
517
|
-
def self.copy_stream: (String | IO src, String | IO dst, ?Integer copy_length, ?Integer src_offset) -> Integer
|
518
|
-
|
519
|
-
def self.popen: (*untyped args) -> untyped
|
520
|
-
|
521
|
-
def self.read: (String name, ?Integer length, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> String
|
522
|
-
|
523
|
-
def self.readlines: (String name, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> ::Array[String]
|
524
|
-
|
525
|
-
def self.select: (::Array[IO]? read_array, ?::Array[IO]? write_array, ?::Array[IO]? error_array, ?Integer? timeout) -> ::Array[::Array[IO]]?
|
526
|
-
|
527
|
-
def self.sysopen: (String path, ?String mode, ?String perm) -> Integer
|
528
|
-
|
529
|
-
def self.try_convert: (untyped arg0) -> IO?
|
530
|
-
|
531
|
-
def self.write: (String name, String arg0, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> Integer
|
532
|
-
|
533
|
-
def self.for_fd: (Integer fd, ?Integer mode, ?Integer opt) -> self
|
534
|
-
|
535
|
-
def bytes: () { (Integer arg0) -> untyped } -> self
|
536
|
-
| () -> ::Enumerator[Integer, self]
|
537
|
-
|
538
|
-
def chars: () { (String arg0) -> untyped } -> self
|
539
|
-
| () -> ::Enumerator[String, self]
|
540
|
-
|
541
|
-
def codepoints: () { (Integer arg0) -> untyped } -> self
|
542
|
-
| () -> ::Enumerator[Integer, self]
|
543
|
-
|
544
|
-
def each_line: (?String sep, ?Integer limit) { (String arg0) -> untyped } -> self
|
545
|
-
| (?String sep, ?Integer limit) -> ::Enumerator[String, self]
|
546
|
-
|
547
|
-
# Returns true if *ios* is at end of file that means there are no more
|
548
|
-
# data to read. The stream must be opened for reading or an `IOError` will
|
549
|
-
# be raised.
|
550
|
-
#
|
551
|
-
# ```ruby
|
552
|
-
# f = File.new("testfile")
|
553
|
-
# dummy = f.readlines
|
554
|
-
# f.eof #=> true
|
555
|
-
# ```
|
556
|
-
#
|
557
|
-
# If *ios* is a stream such as pipe or socket, `IO#eof?` blocks until the
|
558
|
-
# other end sends some data or closes it.
|
559
|
-
#
|
560
|
-
# ```ruby
|
561
|
-
# r, w = IO.pipe
|
562
|
-
# Thread.new { sleep 1; w.close }
|
563
|
-
# r.eof? #=> true after 1 second blocking
|
564
|
-
#
|
565
|
-
# r, w = IO.pipe
|
566
|
-
# Thread.new { sleep 1; w.puts "a" }
|
567
|
-
# r.eof? #=> false after 1 second blocking
|
568
|
-
#
|
569
|
-
# r, w = IO.pipe
|
570
|
-
# r.eof? # blocks forever
|
571
|
-
# ```
|
572
|
-
#
|
573
|
-
# Note that `IO#eof?` reads data to the input byte buffer. So `IO#sysread`
|
574
|
-
# may not behave as you intend with `IO#eof?`, unless you call
|
575
|
-
# `IO#rewind` first (which is not available for some streams).
|
576
|
-
def eof?: () -> bool
|
577
|
-
|
578
|
-
def lines: (?String sep, ?Integer limit) { (String arg0) -> untyped } -> self
|
579
|
-
| (?String sep, ?Integer limit) -> ::Enumerator[String, self]
|
580
|
-
|
581
|
-
# Alias for: [fileno](IO.downloaded.ruby_doc#method-i-fileno)
|
582
|
-
def to_i: () -> Integer
|
583
|
-
end
|
584
|
-
|
585
|
-
IO::APPEND: Integer
|
586
|
-
|
587
|
-
IO::BINARY: Integer
|
588
|
-
|
589
|
-
IO::CREAT: Integer
|
590
|
-
|
591
|
-
IO::DIRECT: Integer
|
592
|
-
|
593
|
-
IO::DSYNC: Integer
|
594
|
-
|
595
|
-
IO::EXCL: Integer
|
596
|
-
|
597
|
-
IO::FNM_CASEFOLD: Integer
|
598
|
-
|
599
|
-
IO::FNM_DOTMATCH: Integer
|
600
|
-
|
601
|
-
IO::FNM_EXTGLOB: Integer
|
602
|
-
|
603
|
-
IO::FNM_NOESCAPE: Integer
|
604
|
-
|
605
|
-
IO::FNM_PATHNAME: Integer
|
606
|
-
|
607
|
-
IO::FNM_SHORTNAME: Integer
|
608
|
-
|
609
|
-
IO::FNM_SYSCASE: Integer
|
610
|
-
|
611
|
-
IO::LOCK_EX: Integer
|
612
|
-
|
613
|
-
IO::LOCK_NB: Integer
|
614
|
-
|
615
|
-
IO::LOCK_SH: Integer
|
616
|
-
|
617
|
-
IO::LOCK_UN: Integer
|
618
|
-
|
619
|
-
IO::NOATIME: Integer
|
620
|
-
|
621
|
-
IO::NOCTTY: Integer
|
622
|
-
|
623
|
-
IO::NOFOLLOW: Integer
|
624
|
-
|
625
|
-
IO::NONBLOCK: Integer
|
626
|
-
|
627
|
-
IO::NULL: String
|
628
|
-
|
629
|
-
IO::RDONLY: Integer
|
630
|
-
|
631
|
-
IO::RDWR: Integer
|
632
|
-
|
633
|
-
IO::RSYNC: Integer
|
634
|
-
|
635
|
-
IO::SEEK_CUR: Integer
|
636
|
-
|
637
|
-
IO::SEEK_DATA: Integer
|
638
|
-
|
639
|
-
IO::SEEK_END: Integer
|
640
|
-
|
641
|
-
IO::SEEK_HOLE: Integer
|
642
|
-
|
643
|
-
IO::SEEK_SET: Integer
|
644
|
-
|
645
|
-
IO::SHARE_DELETE: Integer
|
646
|
-
|
647
|
-
IO::SYNC: Integer
|
648
|
-
|
649
|
-
IO::TMPFILE: Integer
|
650
|
-
|
651
|
-
IO::TRUNC: Integer
|
652
|
-
|
653
|
-
IO::WRONLY: Integer
|
654
|
-
|
655
|
-
class IO::EAGAINWaitReadable < Errno::EAGAIN
|
656
|
-
include IO::WaitReadable
|
657
|
-
end
|
658
|
-
|
659
|
-
IO::EAGAINWaitReadable::Errno: Integer
|
660
|
-
|
661
|
-
class IO::EAGAINWaitWritable < Errno::EAGAIN
|
662
|
-
include IO::WaitWritable
|
663
|
-
end
|
664
|
-
|
665
|
-
IO::EAGAINWaitWritable::Errno: Integer
|
666
|
-
|
667
|
-
class IO::EINPROGRESSWaitReadable < Errno::EINPROGRESS
|
668
|
-
include IO::WaitReadable
|
669
|
-
end
|
670
|
-
|
671
|
-
IO::EINPROGRESSWaitReadable::Errno: Integer
|
672
|
-
|
673
|
-
class IO::EINPROGRESSWaitWritable < Errno::EINPROGRESS
|
674
|
-
include IO::WaitWritable
|
675
|
-
end
|
676
|
-
|
677
|
-
IO::EINPROGRESSWaitWritable::Errno: Integer
|
678
|
-
|
679
|
-
module IO::WaitReadable
|
680
|
-
end
|
681
|
-
|
682
|
-
module IO::WaitWritable
|
683
|
-
end
|