rbs 0.13.1 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +9 -5
  3. data/.gitignore +0 -1
  4. data/CHANGELOG.md +38 -2
  5. data/Gemfile +4 -0
  6. data/README.md +9 -3
  7. data/Rakefile +19 -1
  8. data/Steepfile +1 -1
  9. data/bin/annotate-with-rdoc +1 -1
  10. data/bin/setup +0 -2
  11. data/bin/test_runner.rb +15 -1
  12. data/{stdlib/builtin → core}/array.rbs +124 -120
  13. data/{stdlib/builtin → core}/basic_object.rbs +54 -54
  14. data/{stdlib/builtin → core}/binding.rbs +42 -42
  15. data/core/builtin.rbs +70 -0
  16. data/{stdlib/builtin → core}/class.rbs +33 -33
  17. data/{stdlib/builtin → core}/comparable.rbs +0 -0
  18. data/{stdlib/builtin → core}/complex.rbs +90 -90
  19. data/{stdlib/builtin → core}/constants.rbs +0 -0
  20. data/{stdlib/builtin → core}/data.rbs +0 -0
  21. data/{stdlib/builtin → core}/deprecated.rbs +0 -0
  22. data/{stdlib/builtin → core}/dir.rbs +1 -1
  23. data/{stdlib/builtin → core}/encoding.rbs +33 -33
  24. data/{stdlib/builtin → core}/enumerable.rbs +99 -92
  25. data/{stdlib/builtin → core}/enumerator.rbs +40 -40
  26. data/{stdlib/builtin → core}/errno.rbs +0 -0
  27. data/{stdlib/builtin → core}/errors.rbs +2 -2
  28. data/{stdlib/builtin → core}/exception.rbs +50 -50
  29. data/{stdlib/builtin → core}/false_class.rbs +6 -6
  30. data/{stdlib/builtin → core}/fiber.rbs +14 -14
  31. data/{stdlib/builtin → core}/fiber_error.rbs +1 -1
  32. data/{stdlib/builtin → core}/file.rbs +0 -0
  33. data/{stdlib/builtin → core}/file_test.rbs +0 -0
  34. data/{stdlib/builtin → core}/float.rbs +161 -161
  35. data/{stdlib/builtin → core}/gc.rbs +3 -3
  36. data/{stdlib/builtin → core}/hash.rbs +15 -15
  37. data/{stdlib/builtin → core}/integer.rbs +0 -0
  38. data/{stdlib/builtin → core}/io.rbs +89 -89
  39. data/{stdlib/builtin → core}/kernel.rbs +70 -154
  40. data/{stdlib/builtin → core}/marshal.rbs +0 -0
  41. data/{stdlib/builtin → core}/match_data.rbs +1 -1
  42. data/{stdlib/builtin → core}/math.rbs +0 -0
  43. data/{stdlib/builtin → core}/method.rbs +19 -19
  44. data/{stdlib/builtin → core}/module.rbs +13 -13
  45. data/{stdlib/builtin → core}/nil_class.rbs +20 -20
  46. data/{stdlib/builtin → core}/numeric.rbs +101 -101
  47. data/{stdlib/builtin → core}/object.rbs +173 -173
  48. data/core/object_space.rbs +98 -0
  49. data/{stdlib/builtin → core}/proc.rbs +91 -91
  50. data/{stdlib/builtin → core}/process.rbs +0 -0
  51. data/{stdlib/builtin → core}/random.rbs +1 -1
  52. data/{stdlib/builtin → core}/range.rbs +4 -6
  53. data/{stdlib/builtin → core}/rational.rbs +83 -83
  54. data/{stdlib/builtin → core}/rb_config.rbs +0 -0
  55. data/{stdlib/builtin → core}/regexp.rbs +0 -0
  56. data/{stdlib/builtin → core}/ruby_vm.rbs +0 -0
  57. data/{stdlib/builtin → core}/signal.rbs +7 -7
  58. data/{stdlib/builtin → core}/string.rbs +10 -10
  59. data/{stdlib/builtin → core}/string_io.rbs +8 -8
  60. data/{stdlib/builtin → core}/struct.rbs +2 -2
  61. data/{stdlib/builtin → core}/symbol.rbs +1 -1
  62. data/{stdlib/builtin → core}/thread.rbs +189 -189
  63. data/{stdlib/builtin → core}/thread_group.rbs +2 -2
  64. data/{stdlib/builtin → core}/time.rbs +0 -0
  65. data/{stdlib/builtin → core}/trace_point.rbs +0 -0
  66. data/{stdlib/builtin → core}/true_class.rbs +10 -10
  67. data/{stdlib/builtin → core}/unbound_method.rbs +0 -0
  68. data/{stdlib/builtin → core}/warning.rbs +1 -1
  69. data/docs/CONTRIBUTING.md +1 -0
  70. data/docs/repo.md +125 -0
  71. data/docs/syntax.md +50 -6
  72. data/goodcheck.yml +22 -5
  73. data/lib/rbs.rb +1 -0
  74. data/lib/rbs/ast/comment.rb +1 -1
  75. data/lib/rbs/cli.rb +105 -103
  76. data/lib/rbs/definition.rb +9 -4
  77. data/lib/rbs/definition_builder.rb +54 -22
  78. data/lib/rbs/environment.rb +1 -1
  79. data/lib/rbs/environment_loader.rb +79 -105
  80. data/lib/rbs/environment_walker.rb +58 -29
  81. data/lib/rbs/namespace.rb +1 -1
  82. data/lib/rbs/parser.rb +3153 -0
  83. data/lib/rbs/parser.y +25 -11
  84. data/lib/rbs/prototype/rb.rb +186 -25
  85. data/lib/rbs/prototype/runtime.rb +18 -7
  86. data/lib/rbs/repository.rb +121 -0
  87. data/lib/rbs/test/hook.rb +27 -15
  88. data/lib/rbs/test/setup.rb +5 -3
  89. data/lib/rbs/test/setup_helper.rb +4 -4
  90. data/lib/rbs/test/tester.rb +4 -1
  91. data/lib/rbs/test/type_check.rb +18 -7
  92. data/lib/rbs/type_name.rb +3 -2
  93. data/lib/rbs/variance_calculator.rb +1 -1
  94. data/lib/rbs/vendorer.rb +38 -16
  95. data/lib/rbs/version.rb +1 -1
  96. data/lib/rbs/writer.rb +1 -1
  97. data/sig/cli.rbs +58 -0
  98. data/sig/constant.rbs +2 -2
  99. data/sig/constant_table.rbs +11 -11
  100. data/sig/declarations.rbs +2 -2
  101. data/sig/definition.rbs +10 -5
  102. data/sig/definition_builder.rbs +4 -1
  103. data/sig/environment_loader.rbs +92 -46
  104. data/sig/members.rbs +2 -2
  105. data/sig/method_types.rbs +1 -1
  106. data/sig/namespace.rbs +4 -4
  107. data/sig/parser.rbs +25 -0
  108. data/sig/polyfill.rbs +42 -0
  109. data/sig/rbs.rbs +8 -0
  110. data/sig/repository.rbs +79 -0
  111. data/sig/substitution.rbs +3 -3
  112. data/sig/typename.rbs +1 -1
  113. data/sig/types.rbs +1 -1
  114. data/sig/vendorer.rbs +44 -0
  115. data/sig/writer.rbs +15 -15
  116. data/stdlib/abbrev/{abbrev.rbs → 0/abbrev.rbs} +0 -0
  117. data/stdlib/base64/{base64.rbs → 0/base64.rbs} +1 -1
  118. data/stdlib/benchmark/{benchmark.rbs → 0/benchmark.rbs} +2 -2
  119. data/stdlib/{bigdecimal/math → bigdecimal-math/0}/big_math.rbs +0 -0
  120. data/stdlib/bigdecimal/{big_decimal.rbs → 0/big_decimal.rbs} +0 -0
  121. data/stdlib/coverage/{coverage.rbs → 0/coverage.rbs} +2 -2
  122. data/stdlib/csv/{csv.rbs → 0/csv.rbs} +4 -4
  123. data/stdlib/date/{date.rbs → 0/date.rbs} +4 -4
  124. data/stdlib/date/{date_time.rbs → 0/date_time.rbs} +1 -1
  125. data/stdlib/dbm/0/dbm.rbs +277 -0
  126. data/stdlib/erb/{erb.rbs → 0/erb.rbs} +0 -0
  127. data/stdlib/fiber/{fiber.rbs → 0/fiber.rbs} +0 -0
  128. data/stdlib/find/{find.rbs → 0/find.rbs} +12 -12
  129. data/stdlib/forwardable/{forwardable.rbs → 0/forwardable.rbs} +0 -0
  130. data/stdlib/ipaddr/{ipaddr.rbs → 0/ipaddr.rbs} +0 -0
  131. data/stdlib/json/{json.rbs → 0/json.rbs} +0 -0
  132. data/stdlib/logger/{formatter.rbs → 0/formatter.rbs} +0 -0
  133. data/stdlib/logger/{log_device.rbs → 0/log_device.rbs} +1 -1
  134. data/stdlib/logger/{logger.rbs → 0/logger.rbs} +1 -1
  135. data/stdlib/logger/{period.rbs → 0/period.rbs} +0 -0
  136. data/stdlib/logger/{severity.rbs → 0/severity.rbs} +0 -0
  137. data/stdlib/mutex_m/{mutex_m.rbs → 0/mutex_m.rbs} +0 -0
  138. data/stdlib/pathname/{pathname.rbs → 0/pathname.rbs} +40 -40
  139. data/stdlib/prime/{integer-extension.rbs → 0/integer-extension.rbs} +0 -0
  140. data/stdlib/prime/{prime.rbs → 0/prime.rbs} +1 -1
  141. data/stdlib/pstore/0/pstore.rbs +287 -0
  142. data/stdlib/pty/{pty.rbs → 0/pty.rbs} +1 -1
  143. data/stdlib/securerandom/{securerandom.rbs → 0/securerandom.rbs} +0 -0
  144. data/stdlib/set/{set.rbs → 0/set.rbs} +10 -10
  145. data/stdlib/singleton/0/singleton.rbs +111 -0
  146. data/stdlib/tmpdir/{tmpdir.rbs → 0/tmpdir.rbs} +12 -12
  147. data/stdlib/tsort/0/cyclic.rbs +4 -0
  148. data/stdlib/tsort/0/interfaces.rbs +19 -0
  149. data/stdlib/tsort/0/tsort.rbs +363 -0
  150. data/stdlib/uri/{file.rbs → 0/file.rbs} +0 -0
  151. data/stdlib/uri/{generic.rbs → 0/generic.rbs} +1 -1
  152. data/stdlib/uri/{http.rbs → 0/http.rbs} +0 -0
  153. data/stdlib/uri/{https.rbs → 0/https.rbs} +0 -0
  154. data/stdlib/uri/{ldap.rbs → 0/ldap.rbs} +0 -0
  155. data/stdlib/uri/{ldaps.rbs → 0/ldaps.rbs} +0 -0
  156. data/stdlib/yaml/0/dbm.rbs +221 -0
  157. data/stdlib/yaml/0/store.rbs +53 -0
  158. data/stdlib/zlib/{zlib.rbs → 0/zlib.rbs} +0 -0
  159. data/steep/Gemfile.lock +9 -9
  160. metadata +109 -94
  161. data/stdlib/builtin/builtin.rbs +0 -42
@@ -42,7 +42,7 @@ module GC
42
42
  # are not guaranteed to be future-compatible, and may be ignored if the
43
43
  # underlying implementation does not support them.
44
44
  #
45
- def self.start: (?immediate_sweep: bool immediate_sweep, ?immediate_mark: bool immediate_mark, ?full_mark: bool full_mark) -> nil
45
+ def self.start: (?immediate_sweep: boolish immediate_sweep, ?immediate_mark: boolish immediate_mark, ?full_mark: boolish full_mark) -> nil
46
46
 
47
47
  # Returns a Hash containing information about the GC.
48
48
  #
@@ -132,7 +132,7 @@ module GC
132
132
  | [K] (?Hash[K, untyped] hash) -> ::Hash[::Symbol | K, untyped]
133
133
  | (Symbol key) -> untyped
134
134
 
135
- def garbage_collect: (?immediate_sweep: bool immediate_sweep, ?immediate_mark: bool immediate_mark, ?full_mark: bool full_mark) -> nil
135
+ def garbage_collect: (?immediate_sweep: boolish immediate_sweep, ?immediate_mark: boolish immediate_mark, ?full_mark: boolish full_mark) -> nil
136
136
  end
137
137
 
138
138
  # internal constants
@@ -221,7 +221,7 @@ module GC::Profiler
221
221
  # `:HEAP_LIVE_OBJECTS`
222
222
  # `:HEAP_FREE_OBJECTS`
223
223
  # `:HAVE_FINALIZE`
224
- # :
224
+ # :
225
225
  #
226
226
  def self.raw_data: () -> ::Array[::Hash[Symbol, untyped]]
227
227
 
@@ -106,7 +106,7 @@
106
106
  # See also Object#hash and Object#eql?
107
107
  #
108
108
  class Hash[unchecked out K, unchecked out V] < Object
109
- include Enumerable[[K, V], Hash[K, V]]
109
+ include Enumerable[[K, V]]
110
110
 
111
111
  # Creates a new hash populated with the given objects.
112
112
  #
@@ -143,7 +143,7 @@ class Hash[unchecked out K, unchecked out V] < Object
143
143
  # h2 < h1 #=> false
144
144
  # h1 < h1 #=> false
145
145
  #
146
- def <: (::Hash[K, V]) -> bool
146
+ def <: [A, B] (::Hash[A, B]) -> bool
147
147
 
148
148
  # Returns `true` if *hash* is subset of *other* or equals to *other*.
149
149
  #
@@ -153,7 +153,7 @@ class Hash[unchecked out K, unchecked out V] < Object
153
153
  # h2 <= h1 #=> false
154
154
  # h1 <= h1 #=> true
155
155
  #
156
- def <=: (::Hash[K, V]) -> bool
156
+ def <=: [A, B] (::Hash[A, B]) -> bool
157
157
 
158
158
  # Equality---Two hashes are equal if they each contain the same number of keys
159
159
  # and if each key-value pair is equal to (according to Object#==) the
@@ -183,7 +183,7 @@ class Hash[unchecked out K, unchecked out V] < Object
183
183
  # h2 > h1 #=> true
184
184
  # h1 > h1 #=> false
185
185
  #
186
- def >: (::Hash[K, V]) -> bool
186
+ def >: [A, B] (::Hash[A, B]) -> bool
187
187
 
188
188
  # Returns `true` if *other* is subset of *hash* or equals to *hash*.
189
189
  #
@@ -193,7 +193,7 @@ class Hash[unchecked out K, unchecked out V] < Object
193
193
  # h2 >= h1 #=> true
194
194
  # h1 >= h1 #=> true
195
195
  #
196
- def >=: (::Hash[K, V]) -> bool
196
+ def >=: [A, B] (::Hash[A, B]) -> bool
197
197
 
198
198
  # Element Reference---Retrieves the *value* object corresponding to the *key*
199
199
  # object. If not found, returns the default value (see Hash::new for details).
@@ -230,7 +230,7 @@ class Hash[unchecked out K, unchecked out V] < Object
230
230
  #
231
231
  def any?: () -> bool
232
232
  | (untyped pattern) -> bool
233
- | () { (K, V) -> bool } -> bool
233
+ | () { (K, V) -> boolish } -> bool
234
234
 
235
235
  # Searches through the hash comparing *obj* with the key using `==`. Returns the
236
236
  # key-value pair (two elements array) or `nil` if no match is found. See
@@ -360,7 +360,7 @@ class Hash[unchecked out K, unchecked out V] < Object
360
360
  # h = { "a" => 100, "b" => 200, "c" => 300 }
361
361
  # h.delete_if {|key, value| key >= "b" } #=> {"a"=>100}
362
362
  #
363
- def delete_if: () { (K arg0, V arg1) -> bool } -> self
363
+ def delete_if: () { (K, V) -> boolish } -> self
364
364
  | () -> ::Enumerator[[ K, V ], self]
365
365
 
366
366
  # Extracts the nested value specified by the sequence of *key* objects by
@@ -498,14 +498,14 @@ class Hash[unchecked out K, unchecked out V] < Object
498
498
  #
499
499
  # Hash#filter is an alias for Hash#select.
500
500
  #
501
- def filter: () { (K arg0, V arg1) -> bool } -> self
501
+ def filter: () { (K, V) -> boolish } -> self
502
502
  | () -> ::Enumerator[[ K, V ], self]
503
503
 
504
504
  # Equivalent to Hash#keep_if, but returns `nil` if no changes were made.
505
505
  #
506
506
  # Hash#filter! is an alias for Hash#select!.
507
507
  #
508
- def filter!: () { (K arg0, V arg1) -> bool } -> self?
508
+ def filter!: () { (K, V) -> boolish } -> self?
509
509
  | () -> ::Enumerator[[ K, V ], self?]
510
510
 
511
511
  # Returns a new array that is a one-dimensional flattening of this hash. That
@@ -604,7 +604,7 @@ class Hash[unchecked out K, unchecked out V] < Object
604
604
  #
605
605
  # See also Hash#select!.
606
606
  #
607
- def keep_if: () { (K, V) -> bool } -> self
607
+ def keep_if: () { (K, V) -> boolish } -> self
608
608
  | () -> ::Enumerator[[ K, V ], self]
609
609
 
610
610
  # Returns the key of an occurrence of a given value. If the value is not found,
@@ -720,8 +720,8 @@ class Hash[unchecked out K, unchecked out V] < Object
720
720
  #
721
721
  # Hash#update is an alias for Hash#merge!.
722
722
  #
723
- def merge!: [A, B] (*::Hash[A, B] other_hashes) -> ::Hash[A | K, B | V]
724
- | [A, B, C] (*::Hash[A, B] other_hashes) { (K key, V oldval, B newval) -> (C) } -> ::Hash[A | K, B | V | C]
723
+ def merge!: (*::Hash[K, V] other_hashes) -> self
724
+ | (*::Hash[K, V] other_hashes) { (K key, V oldval, V newval) -> (V) } -> self
725
725
 
726
726
  # Searches through the hash comparing *obj* with the value using `==`. Returns
727
727
  # the first key-value pair (two-element array) that matches. See also
@@ -758,19 +758,19 @@ class Hash[unchecked out K, unchecked out V] < Object
758
758
  # h.reject {|k,v| v > 100} #=> {"a" => 100}
759
759
  #
760
760
  def reject: () -> ::Enumerator[[ K, V ], self]
761
- | () { (K arg0, V arg1) -> bool } -> self
761
+ | () { (K, V) -> boolish } -> self
762
762
 
763
763
  # Equivalent to Hash#delete_if, but returns `nil` if no changes were made.
764
764
  #
765
765
  def reject!: () -> ::Enumerator[[ K, V ], self?]
766
- | () { (K arg0, V arg1) -> bool } -> self?
766
+ | () { (K, V) -> boolish } -> self?
767
767
 
768
768
  # Replaces the contents of *hsh* with the contents of *other_hash*.
769
769
  #
770
770
  # h = { "a" => 100, "b" => 200 }
771
771
  # h.replace({ "c" => 300, "d" => 400 }) #=> {"c"=>300, "d"=>400}
772
772
  #
773
- def replace: [A, B] (Hash[A, B] | _ToHash[A, B]) -> Hash[A, B]
773
+ def replace: (Hash[K, V]) -> self
774
774
 
775
775
  # Returns a new hash consisting of entries for which the block returns true.
776
776
  #
File without changes
@@ -2,7 +2,7 @@
2
2
  # output in Ruby. An I/O stream may be *duplexed* (that is,
3
3
  # bidirectional), and so may use more than one native operating system
4
4
  # stream.
5
- #
5
+ #
6
6
  # Many of the examples in this section use the
7
7
  # [File](https://ruby-doc.org/core-2.6.3/File.html) class, the only
8
8
  # standard subclass of [IO](IO). The two classes are
@@ -10,47 +10,47 @@
10
10
  # [File](https://ruby-doc.org/core-2.6.3/File.html) class, the Socket
11
11
  # library subclasses from [IO](IO) (such as TCPSocket
12
12
  # or UDPSocket).
13
- #
13
+ #
14
14
  # The
15
15
  # [Kernel\#open](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-open)
16
16
  # method can create an [IO](IO) (or
17
17
  # [File](https://ruby-doc.org/core-2.6.3/File.html) ) object for these
18
18
  # types of arguments:
19
- #
19
+ #
20
20
  # - A plain string represents a filename suitable for the underlying
21
21
  # operating system.
22
- #
22
+ #
23
23
  # - A string starting with `"|"` indicates a subprocess. The remainder
24
24
  # of the string following the `"|"` is invoked as a process with
25
25
  # appropriate input/output channels connected to it.
26
- #
26
+ #
27
27
  # - A string equal to `"|-"` will create another Ruby instance as a
28
28
  # subprocess.
29
- #
29
+ #
30
30
  # The [IO](IO) may be opened with different file modes
31
31
  # (read-only, write-only) and encodings for proper conversion. See
32
32
  # [::new](IO#method-c-new) for these options. See
33
33
  # [Kernel\#open](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-open)
34
34
  # for details of the various command formats described above.
35
- #
35
+ #
36
36
  # [::popen](IO#method-c-popen), the Open3 library, or
37
37
  # Process\#spawn may also be used to communicate with subprocesses through
38
38
  # an [IO](IO).
39
- #
39
+ #
40
40
  # Ruby will convert pathnames between different operating system
41
41
  # conventions if possible. For instance, on a Windows system the filename
42
42
  # `"/gumby/ruby/test.rb"` will be opened as `"\gumby\ruby\test.rb"` . When
43
43
  # specifying a Windows-style filename in a Ruby string, remember to escape
44
44
  # the backslashes:
45
- #
45
+ #
46
46
  # ```ruby
47
47
  # "C:\\gumby\\ruby\\test.rb"
48
48
  # ```
49
- #
49
+ #
50
50
  # Our examples here will use the Unix-style forward slashes;
51
51
  # File::ALT\_SEPARATOR can be used to get the platform-specific separator
52
52
  # character.
53
- #
53
+ #
54
54
  # The global constant [ARGF](https://ruby-doc.org/core-2.6.3/ARGF.html)
55
55
  # (also accessible as `$<` ) provides an IO-like stream which allows
56
56
  # access to all files mentioned on the command line (or STDIN if no files
@@ -59,44 +59,44 @@
59
59
  # and its alias
60
60
  # [ARGF\#filename](https://ruby-doc.org/core-2.6.3/ARGF.html#method-i-filename)
61
61
  # are provided to access the name of the file currently being read.
62
- #
63
- #
62
+ #
63
+ #
64
64
  # The io/console extension provides methods for interacting with the
65
65
  # console. The console can be accessed from IO.console or the standard
66
66
  # input/output/error [IO](IO) objects.
67
- #
67
+ #
68
68
  # Requiring io/console adds the following methods:
69
- #
69
+ #
70
70
  # - IO::console
71
- #
71
+ #
72
72
  # - IO\#raw
73
- #
73
+ #
74
74
  # - IO\#raw\!
75
- #
75
+ #
76
76
  # - IO\#cooked
77
- #
77
+ #
78
78
  # - IO\#cooked\!
79
- #
79
+ #
80
80
  # - IO\#getch
81
- #
81
+ #
82
82
  # - IO\#echo=
83
- #
83
+ #
84
84
  # - IO\#echo?
85
- #
85
+ #
86
86
  # - IO\#noecho
87
- #
87
+ #
88
88
  # - IO\#winsize
89
- #
89
+ #
90
90
  # - IO\#winsize=
91
- #
91
+ #
92
92
  # - IO\#iflush
93
- #
93
+ #
94
94
  # - IO\#ioflush
95
- #
95
+ #
96
96
  # - IO\#oflush
97
- #
97
+ #
98
98
  # Example:
99
- #
99
+ #
100
100
  # ```ruby
101
101
  # require 'io/console'
102
102
  # rows, columns = $stdout.winsize
@@ -105,13 +105,13 @@
105
105
  class IO < Object
106
106
  include File::Constants
107
107
 
108
- include Enumerable[String, IO]
108
+ include Enumerable[String]
109
109
 
110
110
  def <<: (untyped arg0) -> self
111
111
 
112
112
  def advise: (Symbol arg0, ?Integer offset, ?Integer len) -> NilClass
113
113
 
114
- def autoclose=: (bool arg0) -> bool
114
+ def autoclose=: (boolish) -> bool
115
115
 
116
116
  # Returns `true` if the underlying file descriptor of *ios* will be closed
117
117
  # automatically at its finalization, otherwise `false` .
@@ -119,11 +119,11 @@ class IO < Object
119
119
 
120
120
  # Puts *ios* into binary mode. Once a stream is in binary mode, it cannot
121
121
  # be reset to nonbinary mode.
122
- #
122
+ #
123
123
  # - newline conversion disabled
124
- #
124
+ #
125
125
  # - encoding conversion disabled
126
- #
126
+ #
127
127
  # - content is treated as ASCII-8BIT
128
128
  def binmode: () -> self
129
129
 
@@ -134,17 +134,17 @@ class IO < Object
134
134
  # stream is unavailable for any further data operations; an `IOError` is
135
135
  # raised if such an attempt is made. I/O streams are automatically closed
136
136
  # when they are claimed by the garbage collector.
137
- #
137
+ #
138
138
  # If *ios* is opened by `IO.popen`, `close` sets `$?` .
139
- #
139
+ #
140
140
  # Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
141
141
  # just ignored since Ruby 2.3.
142
142
  def close: () -> NilClass
143
143
 
144
- def close_on_exec=: (bool arg0) -> bool
144
+ def close_on_exec=: (boolish) -> bool
145
145
 
146
146
  # Returns `true` if *ios* will be closed on exec.
147
- #
147
+ #
148
148
  # ```ruby
149
149
  # f = open("/dev/null")
150
150
  # f.close_on_exec? #=> false
@@ -158,18 +158,18 @@ class IO < Object
158
158
  # Closes the read end of a duplex I/O stream (i.e., one that contains both
159
159
  # a read and a write stream, such as a pipe). Will raise an `IOError` if
160
160
  # the stream is not duplexed.
161
- #
161
+ #
162
162
  # ```ruby
163
163
  # f = IO.popen("/bin/sh","r+")
164
164
  # f.close_read
165
165
  # f.readlines
166
166
  # ```
167
- #
167
+ #
168
168
  # *produces:*
169
- #
169
+ #
170
170
  # prog.rb:3:in `readlines': not opened for reading (IOError)
171
171
  # from prog.rb:3
172
- #
172
+ #
173
173
  # Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
174
174
  # just ignored since Ruby 2.3.
175
175
  def close_read: () -> NilClass
@@ -177,26 +177,26 @@ class IO < Object
177
177
  # Closes the write end of a duplex I/O stream (i.e., one that contains
178
178
  # both a read and a write stream, such as a pipe). Will raise an `IOError`
179
179
  # if the stream is not duplexed.
180
- #
180
+ #
181
181
  # ```ruby
182
182
  # f = IO.popen("/bin/sh","r+")
183
183
  # f.close_write
184
184
  # f.print "nowhere"
185
185
  # ```
186
- #
186
+ #
187
187
  # *produces:*
188
- #
188
+ #
189
189
  # prog.rb:3:in `write': not opened for writing (IOError)
190
190
  # from prog.rb:3:in `print'
191
191
  # from prog.rb:3
192
- #
192
+ #
193
193
  # Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
194
194
  # just ignored since Ruby 2.3.
195
195
  def close_write: () -> NilClass
196
196
 
197
197
  # Returns `true` if *ios* is completely closed (for duplex streams, both
198
198
  # reader and writer), `false` otherwise.
199
- #
199
+ #
200
200
  # ```ruby
201
201
  # f = File.new("testfile")
202
202
  # f.close #=> nil
@@ -224,29 +224,29 @@ class IO < Object
224
224
  # Returns true if *ios* is at end of file that means there are no more
225
225
  # data to read. The stream must be opened for reading or an `IOError` will
226
226
  # be raised.
227
- #
227
+ #
228
228
  # ```ruby
229
229
  # f = File.new("testfile")
230
230
  # dummy = f.readlines
231
231
  # f.eof #=> true
232
232
  # ```
233
- #
233
+ #
234
234
  # If *ios* is a stream such as pipe or socket, `IO#eof?` blocks until the
235
235
  # other end sends some data or closes it.
236
- #
236
+ #
237
237
  # ```ruby
238
238
  # r, w = IO.pipe
239
239
  # Thread.new { sleep 1; w.close }
240
240
  # r.eof? #=> true after 1 second blocking
241
- #
241
+ #
242
242
  # r, w = IO.pipe
243
243
  # Thread.new { sleep 1; w.puts "a" }
244
244
  # r.eof? #=> false after 1 second blocking
245
- #
245
+ #
246
246
  # r, w = IO.pipe
247
247
  # r.eof? # blocks forever
248
248
  # ```
249
- #
249
+ #
250
250
  # Note that `IO#eof?` reads data to the input byte buffer. So `IO#sysread`
251
251
  # may not behave as you intend with `IO#eof?`, unless you call
252
252
  # `IO#rewind` first (which is not available for some streams).
@@ -255,35 +255,35 @@ class IO < Object
255
255
  def fcntl: (Integer integer_cmd, String | Integer arg) -> Integer
256
256
 
257
257
  # Immediately writes all buffered data in *ios* to disk.
258
- #
258
+ #
259
259
  # If the underlying operating system does not support *fdatasync(2)* ,
260
260
  # `IO#fsync` is called instead (which might raise a `NotImplementedError`
261
261
  # ).
262
262
  def fdatasync: () -> Integer?
263
263
 
264
264
  # Returns an integer representing the numeric file descriptor for *ios* .
265
- #
265
+ #
266
266
  # ```ruby
267
267
  # $stdin.fileno #=> 0
268
268
  # $stdout.fileno #=> 1
269
269
  # ```
270
- #
271
- #
272
- #
270
+ #
271
+ #
272
+ #
273
273
  # Also aliased as: [to\_i](IO.downloaded.ruby_doc#method-i-to_i)
274
274
  def fileno: () -> Integer
275
275
 
276
276
  # Flushes any buffered data within *ios* to the underlying operating
277
277
  # system (note that this is Ruby internal buffering only; the OS may
278
278
  # buffer the data as well).
279
- #
279
+ #
280
280
  # ```ruby
281
281
  # $stdout.print "no newline"
282
282
  # $stdout.flush
283
283
  # ```
284
- #
284
+ #
285
285
  # *produces:*
286
- #
286
+ #
287
287
  # ```ruby
288
288
  # no newline
289
289
  # ```
@@ -293,14 +293,14 @@ class IO < Object
293
293
  # differs from using `IO#sync=` . The latter ensures that data is flushed
294
294
  # from Ruby’s buffers, but does not guarantee that the underlying
295
295
  # operating system actually writes it to disk.
296
- #
296
+ #
297
297
  # `NotImplementedError` is raised if the underlying operating system does
298
298
  # not support *fsync(2)* .
299
299
  def fsync: () -> Integer?
300
300
 
301
301
  # Gets the next 8-bit byte (0..255) from *ios* . Returns `nil` if called
302
302
  # at end of file.
303
- #
303
+ #
304
304
  # ```ruby
305
305
  # f = File.new("testfile")
306
306
  # f.getbyte #=> 84
@@ -310,7 +310,7 @@ class IO < Object
310
310
 
311
311
  # Reads a one-character string from *ios* . Returns `nil` if called at end
312
312
  # of file.
313
- #
313
+ #
314
314
  # ```ruby
315
315
  # f = File.new("testfile")
316
316
  # f.getc #=> "h"
@@ -334,7 +334,7 @@ class IO < Object
334
334
 
335
335
  # Returns `true` if *ios* is associated with a terminal device (tty),
336
336
  # `false` otherwise.
337
- #
337
+ #
338
338
  # ```ruby
339
339
  # File.new("testfile").isatty #=> false
340
340
  # File.new("/dev/tty").isatty #=> true
@@ -347,14 +347,14 @@ class IO < Object
347
347
  # number of newlines encountered. The two values will differ if
348
348
  # [gets](IO.downloaded.ruby_doc#method-i-gets) is called with a separator
349
349
  # other than newline.
350
- #
350
+ #
351
351
  # Methods that use `$/` like [each](IO.downloaded.ruby_doc#method-i-each)
352
352
  # , [lines](IO.downloaded.ruby_doc#method-i-lines) and
353
353
  # [readline](IO.downloaded.ruby_doc#method-i-readline) will also increment
354
354
  # `lineno` .
355
- #
355
+ #
356
356
  # See also the `$.` variable.
357
- #
357
+ #
358
358
  # ```ruby
359
359
  # f = File.new("testfile")
360
360
  # f.lineno #=> 0
@@ -369,7 +369,7 @@ class IO < Object
369
369
 
370
370
  # Returns the process ID of a child process associated with *ios* . This
371
371
  # will be set by `IO.popen` .
372
- #
372
+ #
373
373
  # ```ruby
374
374
  # pipe = IO.popen("-")
375
375
  # if pipe
@@ -378,15 +378,15 @@ class IO < Object
378
378
  # $stderr.puts "In child, pid is #{$$}"
379
379
  # end
380
380
  # ```
381
- #
381
+ #
382
382
  # *produces:*
383
- #
383
+ #
384
384
  # In child, pid is 26209
385
385
  # In parent, child pid is 26209
386
386
  def pid: () -> Integer
387
387
 
388
388
  # Returns the current offset (in bytes) of *ios* .
389
- #
389
+ #
390
390
  # ```ruby
391
391
  # f = File.new("testfile")
392
392
  # f.pos #=> 0
@@ -416,7 +416,7 @@ class IO < Object
416
416
 
417
417
  # Reads a one-character string from *ios* . Raises an `EOFError` on end of
418
418
  # file.
419
- #
419
+ #
420
420
  # ```ruby
421
421
  # f = File.new("testfile")
422
422
  # f.readchar #=> "h"
@@ -435,7 +435,7 @@ class IO < Object
435
435
  | (String other_IO_or_path, ?String mode_str) -> IO
436
436
 
437
437
  # Positions *ios* to the beginning of input, resetting `lineno` to zero.
438
- #
438
+ #
439
439
  # ```ruby
440
440
  # f = File.new("testfile")
441
441
  # f.readline #=> "This is line one\n"
@@ -443,7 +443,7 @@ class IO < Object
443
443
  # f.lineno #=> 0
444
444
  # f.readline #=> "This is line one\n"
445
445
  # ```
446
- #
446
+ #
447
447
  # Note that it cannot be used with streams such as pipes, ttys, and
448
448
  # sockets.
449
449
  def rewind: () -> Integer
@@ -454,7 +454,7 @@ class IO < Object
454
454
  | (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc) -> self
455
455
 
456
456
  # Returns status information for *ios* as an object of type `File::Stat` .
457
- #
457
+ #
458
458
  # ```ruby
459
459
  # f = File.new("testfile")
460
460
  # s = f.stat
@@ -467,14 +467,14 @@ class IO < Object
467
467
  # Returns the current “sync mode” of *ios* . When sync mode is true, all
468
468
  # output is immediately flushed to the underlying operating system and is
469
469
  # not buffered by Ruby internally. See also `IO#fsync` .
470
- #
470
+ #
471
471
  # ```ruby
472
472
  # f = File.new("testfile")
473
473
  # f.sync #=> false
474
474
  # ```
475
475
  def sync: () -> bool
476
476
 
477
- def sync=: (bool arg0) -> bool
477
+ def sync=: (boolish) -> bool
478
478
 
479
479
  def sysread: (Integer maxlen, String outbuf) -> String
480
480
 
@@ -483,7 +483,7 @@ class IO < Object
483
483
  def syswrite: (_ToS arg0) -> Integer
484
484
 
485
485
  # Returns the current offset (in bytes) of *ios* .
486
- #
486
+ #
487
487
  # ```ruby
488
488
  # f = File.new("testfile")
489
489
  # f.pos #=> 0
@@ -497,7 +497,7 @@ class IO < Object
497
497
 
498
498
  # Returns `true` if *ios* is associated with a terminal device (tty),
499
499
  # `false` otherwise.
500
- #
500
+ #
501
501
  # ```ruby
502
502
  # File.new("testfile").isatty #=> false
503
503
  # File.new("/dev/tty").isatty #=> true
@@ -514,7 +514,7 @@ class IO < Object
514
514
 
515
515
  def self.binwrite: (String name, _ToS 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
516
 
517
- def self.copy_stream: (String | IO src, String | IO dst, ?Integer copy_length, ?Integer src_offset) -> Integer
517
+ def self.copy_stream: (_Reader src, _Writer dst, ?Integer copy_length, ?Integer src_offset) -> Integer
518
518
 
519
519
  def self.popen: (*untyped args) -> untyped
520
520
 
@@ -522,7 +522,7 @@ class IO < Object
522
522
 
523
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
524
 
525
- def self.select: (::Array[IO]? read_array, ?::Array[IO]? write_array, ?::Array[IO]? error_array, ?Integer? timeout) -> ::Array[::Array[IO]]?
525
+ def self.select: (::Array[io]? read_array, ?::Array[io]? write_array, ?::Array[io]? error_array, ?Integer? timeout) -> ::Array[::Array[io]]?
526
526
 
527
527
  def self.sysopen: (String path, ?String mode, ?String perm) -> Integer
528
528
 
@@ -547,29 +547,29 @@ class IO < Object
547
547
  # Returns true if *ios* is at end of file that means there are no more
548
548
  # data to read. The stream must be opened for reading or an `IOError` will
549
549
  # be raised.
550
- #
550
+ #
551
551
  # ```ruby
552
552
  # f = File.new("testfile")
553
553
  # dummy = f.readlines
554
554
  # f.eof #=> true
555
555
  # ```
556
- #
556
+ #
557
557
  # If *ios* is a stream such as pipe or socket, `IO#eof?` blocks until the
558
558
  # other end sends some data or closes it.
559
- #
559
+ #
560
560
  # ```ruby
561
561
  # r, w = IO.pipe
562
562
  # Thread.new { sleep 1; w.close }
563
563
  # r.eof? #=> true after 1 second blocking
564
- #
564
+ #
565
565
  # r, w = IO.pipe
566
566
  # Thread.new { sleep 1; w.puts "a" }
567
567
  # r.eof? #=> false after 1 second blocking
568
- #
568
+ #
569
569
  # r, w = IO.pipe
570
570
  # r.eof? # blocks forever
571
571
  # ```
572
- #
572
+ #
573
573
  # Note that `IO#eof?` reads data to the input byte buffer. So `IO#sysread`
574
574
  # may not behave as you intend with `IO#eof?`, unless you call
575
575
  # `IO#rewind` first (which is not available for some streams).