rbs 3.3.2 → 3.4.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -5
  3. data/.github/workflows/ruby.yml +7 -8
  4. data/.github/workflows/typecheck.yml +37 -0
  5. data/CHANGELOG.md +50 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +11 -11
  8. data/Steepfile +2 -2
  9. data/core/array.rbs +19 -49
  10. data/core/basic_object.rbs +2 -2
  11. data/core/comparable.rbs +17 -8
  12. data/core/complex.rbs +82 -43
  13. data/core/data.rbs +2 -4
  14. data/core/dir.rbs +635 -295
  15. data/core/enumerable.rbs +11 -18
  16. data/core/enumerator.rbs +37 -31
  17. data/core/errors.rbs +4 -0
  18. data/core/false_class.rbs +34 -15
  19. data/core/fiber.rbs +23 -0
  20. data/core/file.rbs +329 -120
  21. data/core/float.rbs +17 -32
  22. data/core/gc.rbs +17 -11
  23. data/core/hash.rbs +22 -44
  24. data/core/integer.rbs +82 -113
  25. data/core/io/buffer.rbs +90 -47
  26. data/core/io.rbs +39 -116
  27. data/core/kernel.rbs +442 -489
  28. data/core/match_data.rbs +55 -56
  29. data/core/module.rbs +45 -1
  30. data/core/nil_class.rbs +98 -35
  31. data/core/numeric.rbs +22 -32
  32. data/core/object_space/weak_key_map.rbs +102 -0
  33. data/core/process.rbs +1242 -655
  34. data/core/ractor.rbs +139 -120
  35. data/core/range.rbs +100 -4
  36. data/core/rational.rbs +0 -4
  37. data/core/rbs/unnamed/argf.rbs +16 -8
  38. data/core/rbs/unnamed/env_class.rbs +0 -24
  39. data/core/refinement.rbs +8 -0
  40. data/core/regexp.rbs +1149 -598
  41. data/core/ruby_vm.rbs +126 -12
  42. data/core/rubygems/platform.rbs +9 -0
  43. data/core/rubygems/rubygems.rbs +1 -1
  44. data/core/rubygems/version.rbs +5 -1
  45. data/core/set.rbs +20 -22
  46. data/core/signal.rbs +4 -4
  47. data/core/string.rbs +283 -230
  48. data/core/string_io.rbs +2 -14
  49. data/core/struct.rbs +404 -24
  50. data/core/symbol.rbs +1 -19
  51. data/core/thread.rbs +29 -12
  52. data/core/time.rbs +227 -104
  53. data/core/trace_point.rbs +2 -5
  54. data/core/true_class.rbs +54 -21
  55. data/core/warning.rbs +14 -11
  56. data/docs/data_and_struct.md +29 -0
  57. data/docs/syntax.md +3 -5
  58. data/docs/tools.md +1 -0
  59. data/ext/rbs_extension/lexer.c +643 -559
  60. data/ext/rbs_extension/lexer.re +5 -1
  61. data/ext/rbs_extension/parser.c +12 -3
  62. data/ext/rbs_extension/unescape.c +7 -47
  63. data/lib/rbs/cli/diff.rb +4 -1
  64. data/lib/rbs/cli/validate.rb +280 -0
  65. data/lib/rbs/cli.rb +2 -194
  66. data/lib/rbs/collection/config.rb +5 -6
  67. data/lib/rbs/collection/sources/git.rb +1 -1
  68. data/lib/rbs/collection.rb +1 -0
  69. data/lib/rbs/diff.rb +7 -4
  70. data/lib/rbs/errors.rb +11 -0
  71. data/lib/rbs/test/errors.rb +4 -1
  72. data/lib/rbs/test/guaranteed.rb +2 -3
  73. data/lib/rbs/test/type_check.rb +15 -10
  74. data/lib/rbs/test.rb +3 -3
  75. data/lib/rbs/types.rb +29 -0
  76. data/lib/rbs/unit_test/convertibles.rb +176 -0
  77. data/lib/rbs/unit_test/spy.rb +136 -0
  78. data/lib/rbs/unit_test/type_assertions.rb +341 -0
  79. data/lib/rbs/unit_test/with_aliases.rb +143 -0
  80. data/lib/rbs/unit_test.rb +6 -0
  81. data/lib/rbs/version.rb +1 -1
  82. data/sig/cli/validate.rbs +43 -0
  83. data/sig/diff.rbs +3 -1
  84. data/sig/errors.rbs +8 -0
  85. data/sig/rbs.rbs +1 -1
  86. data/sig/test/errors.rbs +52 -0
  87. data/sig/test/guranteed.rbs +9 -0
  88. data/sig/test/type_check.rbs +19 -0
  89. data/sig/test.rbs +82 -0
  90. data/sig/types.rbs +6 -1
  91. data/sig/unit_test/convertibles.rbs +154 -0
  92. data/sig/unit_test/spy.rbs +28 -0
  93. data/sig/unit_test/type_assertions.rbs +194 -0
  94. data/sig/unit_test/with_aliases.rbs +136 -0
  95. data/stdlib/base64/0/base64.rbs +307 -45
  96. data/stdlib/bigdecimal/0/big_decimal.rbs +35 -15
  97. data/stdlib/coverage/0/coverage.rbs +2 -2
  98. data/stdlib/csv/0/csv.rbs +25 -55
  99. data/stdlib/date/0/date.rbs +1 -43
  100. data/stdlib/date/0/date_time.rbs +1 -13
  101. data/stdlib/delegate/0/delegator.rbs +186 -0
  102. data/stdlib/delegate/0/kernel.rbs +47 -0
  103. data/stdlib/delegate/0/simple_delegator.rbs +98 -0
  104. data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
  105. data/stdlib/erb/0/erb.rbs +2 -2
  106. data/stdlib/fileutils/0/fileutils.rbs +0 -19
  107. data/stdlib/io-console/0/io-console.rbs +12 -1
  108. data/stdlib/ipaddr/0/ipaddr.rbs +2 -1
  109. data/stdlib/json/0/json.rbs +320 -81
  110. data/stdlib/logger/0/logger.rbs +9 -5
  111. data/stdlib/monitor/0/monitor.rbs +78 -0
  112. data/stdlib/net-http/0/net-http.rbs +1880 -543
  113. data/stdlib/objspace/0/objspace.rbs +19 -13
  114. data/stdlib/openssl/0/openssl.rbs +508 -127
  115. data/stdlib/optparse/0/optparse.rbs +25 -11
  116. data/stdlib/pathname/0/pathname.rbs +1 -1
  117. data/stdlib/pp/0/pp.rbs +2 -5
  118. data/stdlib/prettyprint/0/prettyprint.rbs +2 -2
  119. data/stdlib/pstore/0/pstore.rbs +2 -4
  120. data/stdlib/rdoc/0/comment.rbs +1 -2
  121. data/stdlib/resolv/0/resolv.rbs +4 -2
  122. data/stdlib/socket/0/socket.rbs +2 -2
  123. data/stdlib/socket/0/unix_socket.rbs +2 -2
  124. data/stdlib/strscan/0/string_scanner.rbs +3 -2
  125. data/stdlib/tempfile/0/tempfile.rbs +1 -1
  126. data/stdlib/uri/0/common.rbs +245 -123
  127. metadata +23 -4
  128. data/lib/rbs/test/spy.rb +0 -6
data/core/io.rbs CHANGED
@@ -110,7 +110,7 @@
110
110
  #
111
111
  #
112
112
  # Also available are the options offered in String#encode, which may control
113
- # conversion between external internal encoding.
113
+ # conversion between external and internal encoding.
114
114
  #
115
115
  # ## Basic IO
116
116
  #
@@ -398,7 +398,7 @@
398
398
  # # => 41
399
399
  # f.close
400
400
  #
401
- # * When a stream is read, `#.` is set to the line number for that stream:
401
+ # * When a stream is read, `$.` is set to the line number for that stream:
402
402
  #
403
403
  # f0 = File.new('t.txt')
404
404
  # f1 = File.new('t.dat')
@@ -684,14 +684,14 @@ class IO < Object
684
684
  # -->
685
685
  # Sets auto-close flag.
686
686
  #
687
- # f = open("/dev/null")
688
- # IO.for_fd(f.fileno)
689
- # # ...
690
- # f.gets # may cause Errno::EBADF
687
+ # f = File.open(File::NULL)
688
+ # IO.for_fd(f.fileno).close
689
+ # f.gets # raises Errno::EBADF
691
690
  #
692
- # f = open("/dev/null")
693
- # IO.for_fd(f.fileno).autoclose = false
694
- # # ...
691
+ # f = File.open(File::NULL)
692
+ # g = IO.for_fd(f.fileno)
693
+ # g.autoclose = false
694
+ # g.close
695
695
  # f.gets # won't cause Errno::EBADF
696
696
  #
697
697
  def autoclose=: (boolish bool) -> boolish
@@ -700,8 +700,8 @@ class IO < Object
700
700
  # rdoc-file=io.c
701
701
  # - ios.autoclose? -> true or false
702
702
  # -->
703
- # Returns `true` if the underlying file descriptor of *ios* will be closed
704
- # automatically at its finalization, otherwise `false`.
703
+ # Returns `true` if the underlying file descriptor of *ios* will be closed at
704
+ # its finalization or at calling #close, otherwise `false`.
705
705
  #
706
706
  def autoclose?: () -> bool
707
707
 
@@ -764,7 +764,7 @@ class IO < Object
764
764
  # -->
765
765
  # Sets a close-on-exec flag.
766
766
  #
767
- # f = open("/dev/null")
767
+ # f = File.open(File::NULL)
768
768
  # f.close_on_exec = true
769
769
  # system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
770
770
  # f.closed? #=> false
@@ -976,8 +976,6 @@ class IO < Object
976
976
  # not behave as you intend with IO#eof?, unless you call IO#rewind first (which
977
977
  # is not available for some streams).
978
978
  #
979
- # IO#eof? is an alias for IO#eof.
980
- #
981
979
  def eof: () -> bool
982
980
 
983
981
  # <!--
@@ -988,7 +986,7 @@ class IO < Object
988
986
  # provides a mechanism for issuing low-level commands to control or query a
989
987
  # file-oriented I/O stream. Arguments and results are platform dependent.
990
988
  #
991
- # If +argument is a number, its value is passed directly; if it is a string, it
989
+ # If `argument` is a number, its value is passed directly; if it is a string, it
992
990
  # is interpreted as a binary sequence of bytes. (Array#pack might be a useful
993
991
  # way to build this string.)
994
992
  #
@@ -1018,8 +1016,6 @@ class IO < Object
1018
1016
  # File.open('t.txt').fileno # => 10
1019
1017
  # f.close
1020
1018
  #
1021
- # IO#to_i is an alias for IO#fileno.
1022
- #
1023
1019
  def fileno: () -> Integer
1024
1020
 
1025
1021
  # <!--
@@ -1160,7 +1156,8 @@ class IO < Object
1160
1156
  # f.gets(chomp: true) # => nil
1161
1157
  # f.close
1162
1158
  #
1163
- def gets: (?String sep, ?Integer limit) -> String?
1159
+ def gets: (string? sep, ?int limit, ?chomp: boolish) -> String?
1160
+ | (?int limit, ?chomp: boolish) -> String?
1164
1161
 
1165
1162
  # <!--
1166
1163
  # rdoc-file=io.c
@@ -1256,8 +1253,6 @@ class IO < Object
1256
1253
  # f = File.new('/dev/tty').isatty #=> true
1257
1254
  # f.close
1258
1255
  #
1259
- # IO#tty? is an alias for IO#isatty.
1260
- #
1261
1256
  def isatty: () -> bool
1262
1257
 
1263
1258
  # <!--
@@ -1632,7 +1627,7 @@ class IO < Object
1632
1627
  def readchar: () -> String
1633
1628
 
1634
1629
  # <!--
1635
- # rdoc-file=io.c
1630
+ # rdoc-file=io.rb
1636
1631
  # - readline(sep = $/, chomp: false) -> string
1637
1632
  # - readline(limit, chomp: false) -> string
1638
1633
  # - readline(sep, limit, chomp: false) -> string
@@ -1915,16 +1910,19 @@ class IO < Object
1915
1910
  # -->
1916
1911
  # See [Encodings](rdoc-ref:File@Encodings).
1917
1912
  #
1918
- # Argument `ext_enc`, if given, must be an Encoding object; it is assigned as
1919
- # the encoding for the stream.
1913
+ # Argument `ext_enc`, if given, must be an Encoding object or a String with the
1914
+ # encoding name; it is assigned as the encoding for the stream.
1920
1915
  #
1921
- # Argument `int_enc`, if given, must be an Encoding object; it is assigned as
1922
- # the encoding for the internal string.
1916
+ # Argument `int_enc`, if given, must be an Encoding object or a String with the
1917
+ # encoding name; it is assigned as the encoding for the internal string.
1923
1918
  #
1924
1919
  # Argument `'ext_enc:int_enc'`, if given, is a string containing two
1925
1920
  # colon-separated encoding names; corresponding Encoding objects are assigned as
1926
1921
  # the external and internal encodings for the stream.
1927
1922
  #
1923
+ # If the external encoding of a string is binary/ASCII-8BIT, the internal
1924
+ # encoding of the string is set to nil, since no transcoding is needed.
1925
+ #
1928
1926
  # Optional keyword arguments `enc_opts` specify [Encoding
1929
1927
  # options](rdoc-ref:encodings.rdoc@Encoding+Options).
1930
1928
  #
@@ -2066,8 +2064,6 @@ class IO < Object
2066
2064
  #
2067
2065
  # Related: IO#pos=, IO#seek.
2068
2066
  #
2069
- # IO#pos is an alias for IO#tell.
2070
- #
2071
2067
  def tell: () -> Integer
2072
2068
 
2073
2069
  # <!-- rdoc-file=io.c -->
@@ -2082,8 +2078,6 @@ class IO < Object
2082
2078
  #
2083
2079
  # Related: IO#pos=, IO#seek.
2084
2080
  #
2085
- # IO#pos is an alias for IO#tell.
2086
- #
2087
2081
  alias pos tell
2088
2082
 
2089
2083
  # <!--
@@ -2099,8 +2093,11 @@ class IO < Object
2099
2093
  # - timeout = duration -> duration
2100
2094
  # - timeout = nil -> nil
2101
2095
  # -->
2102
- # Set the internal timeout to the specified duration or nil. The timeout applies
2103
- # to all blocking operations where possible.
2096
+ # Sets the internal timeout to the specified duration or nil. The timeout
2097
+ # applies to all blocking operations where possible.
2098
+ #
2099
+ # When the operation performs longer than the timeout set, IO::TimeoutError is
2100
+ # raised.
2104
2101
  #
2105
2102
  # This affects the following methods (but is not limited to): #gets, #puts,
2106
2103
  # #read, #write, #wait_readable and #wait_writable. This also affects blocking
@@ -2131,8 +2128,6 @@ class IO < Object
2131
2128
  # f = File.new('/dev/tty').isatty #=> true
2132
2129
  # f.close
2133
2130
  #
2134
- # IO#tty? is an alias for IO#isatty.
2135
- #
2136
2131
  alias tty? isatty
2137
2132
 
2138
2133
  # <!--
@@ -2298,7 +2293,6 @@ class IO < Object
2298
2293
 
2299
2294
  # <!--
2300
2295
  # rdoc-file=io.c
2301
- # - IO.binread(command, length = nil, offset = 0) -> string or nil
2302
2296
  # - IO.binread(path, length = nil, offset = 0) -> string or nil
2303
2297
  # -->
2304
2298
  # Behaves like IO.read, except that the stream is opened in binary mode with
@@ -2312,7 +2306,6 @@ class IO < Object
2312
2306
 
2313
2307
  # <!--
2314
2308
  # rdoc-file=io.c
2315
- # - IO.binwrite(command, string, offset = 0) -> integer
2316
2309
  # - IO.binwrite(path, string, offset = 0) -> integer
2317
2310
  # -->
2318
2311
  # Behaves like IO.write, except that the stream is opened in binary mode with
@@ -2550,9 +2543,6 @@ class IO < Object
2550
2543
  # - IO.foreach(path, sep = $/, **opts) {|line| block } -> nil
2551
2544
  # - IO.foreach(path, limit, **opts) {|line| block } -> nil
2552
2545
  # - IO.foreach(path, sep, limit, **opts) {|line| block } -> nil
2553
- # - IO.foreach(command, sep = $/, **opts) {|line| block } -> nil
2554
- # - IO.foreach(command, limit, **opts) {|line| block } -> nil
2555
- # - IO.foreach(command, sep, limit, **opts) {|line| block } -> nil
2556
2546
  # - IO.foreach(...) -> an_enumerator
2557
2547
  # -->
2558
2548
  # Calls the block with each successive line read from the stream.
@@ -2561,17 +2551,7 @@ class IO < Object
2561
2551
  # potential security vulnerabilities if called with untrusted input; see
2562
2552
  # [Command Injection](rdoc-ref:command_injection.rdoc).
2563
2553
  #
2564
- # The first argument must be a string that is one of the following:
2565
- #
2566
- # * Path: if `self` is a subclass of IO (File, for example), or if the string
2567
- # *does* *not* start with the pipe character (`'|'`), the string is the path
2568
- # to a file.
2569
- # * Command: if `self` is the class IO, and if the string starts with the pipe
2570
- # character, the rest of the string is a command to be executed as a
2571
- # subprocess. This usage has potential security vulnerabilities if called
2572
- # with untrusted input; see [Command
2573
- # Injection](rdoc-ref:command_injection.rdoc).
2574
- #
2554
+ # The first argument must be a string that is the path to a file.
2575
2555
  #
2576
2556
  # With only argument `path` given, parses lines from the file at the given
2577
2557
  # `path`, as determined by the default line separator, and calls the block with
@@ -2631,7 +2611,7 @@ class IO < Object
2631
2611
  #
2632
2612
  # * [Open Options](rdoc-ref:IO@Open+Options).
2633
2613
  # * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
2634
- # * [Line Options](rdoc-ref:IO@Line+Options).
2614
+ # * [Line Options](rdoc-ref:IO@Line+IO).
2635
2615
  #
2636
2616
  #
2637
2617
  # Returns an Enumerator if no block is given.
@@ -2644,9 +2624,9 @@ class IO < Object
2644
2624
  # - IO.pipe(**opts) -> [read_io, write_io]
2645
2625
  # - IO.pipe(enc, **opts) -> [read_io, write_io]
2646
2626
  # - IO.pipe(ext_enc, int_enc, **opts) -> [read_io, write_io]
2647
- # - IO.pipe(**opts) {|read_io, write_io] ...} -> object
2648
- # - IO.pipe(enc, **opts) {|read_io, write_io] ...} -> object
2649
- # - IO.pipe(ext_enc, int_enc, **opts) {|read_io, write_io] ...} -> object
2627
+ # - IO.pipe(**opts) {|read_io, write_io| ...} -> object
2628
+ # - IO.pipe(enc, **opts) {|read_io, write_io| ...} -> object
2629
+ # - IO.pipe(ext_enc, int_enc, **opts) {|read_io, write_io| ...} -> object
2650
2630
  # -->
2651
2631
  # Creates a pair of pipe endpoints, `read_io` and `write_io`, connected to each
2652
2632
  # other.
@@ -2722,7 +2702,6 @@ class IO < Object
2722
2702
 
2723
2703
  # <!--
2724
2704
  # rdoc-file=io.c
2725
- # - IO.read(command, length = nil, offset = 0, **opts) -> string or nil
2726
2705
  # - IO.read(path, length = nil, offset = 0, **opts) -> string or nil
2727
2706
  # -->
2728
2707
  # Opens the stream, reads and returns some or all of its content, and closes the
@@ -2732,19 +2711,7 @@ class IO < Object
2732
2711
  # potential security vulnerabilities if called with untrusted input; see
2733
2712
  # [Command Injection](rdoc-ref:command_injection.rdoc).
2734
2713
  #
2735
- # The first argument must be a string; its meaning depends on whether it starts
2736
- # with the pipe character (`'|'`):
2737
- #
2738
- # * If so (and if `self` is IO), the rest of the string is a command to be
2739
- # executed as a subprocess.
2740
- # * Otherwise, the string is the path to a file.
2741
- #
2742
- #
2743
- # With only argument `command` given, executes the command in a shell, returns
2744
- # its entire $stdout:
2745
- #
2746
- # IO.read('| cat t.txt')
2747
- # # => "First line\nSecond line\n\nThird line\nFourth line\n"
2714
+ # The first argument must be a string that is the path to a file.
2748
2715
  #
2749
2716
  # With only argument `path` given, reads in text mode and returns the entire
2750
2717
  # content of the file at the given path:
@@ -2756,8 +2723,6 @@ class IO < Object
2756
2723
  # when encountering certain special bytes. Consider using IO.binread if all
2757
2724
  # bytes in the file should be read.
2758
2725
  #
2759
- # For both forms, command and path, the remaining arguments are the same.
2760
- #
2761
2726
  # With argument `length`, returns `length` bytes if available:
2762
2727
  #
2763
2728
  # IO.read('t.txt', 7) # => "First l"
@@ -2779,9 +2744,6 @@ class IO < Object
2779
2744
 
2780
2745
  # <!--
2781
2746
  # rdoc-file=io.c
2782
- # - IO.readlines(command, sep = $/, **opts) -> array
2783
- # - IO.readlines(command, limit, **opts) -> array
2784
- # - IO.readlines(command, sep, limit, **opts) -> array
2785
2747
  # - IO.readlines(path, sep = $/, **opts) -> array
2786
2748
  # - IO.readlines(path, limit, **opts) -> array
2787
2749
  # - IO.readlines(path, sep, limit, **opts) -> array
@@ -2792,20 +2754,7 @@ class IO < Object
2792
2754
  # potential security vulnerabilities if called with untrusted input; see
2793
2755
  # [Command Injection](rdoc-ref:command_injection.rdoc).
2794
2756
  #
2795
- # The first argument must be a string; its meaning depends on whether it starts
2796
- # with the pipe character (`'|'`):
2797
- #
2798
- # * If so (and if `self` is IO), the rest of the string is a command to be
2799
- # executed as a subprocess.
2800
- # * Otherwise, the string is the path to a file.
2801
- #
2802
- #
2803
- # With only argument `command` given, executes the command in a shell, parses
2804
- # its $stdout into lines, as determined by the default line separator, and
2805
- # returns those lines in an array:
2806
- #
2807
- # IO.readlines('| cat t.txt')
2808
- # # => ["First line\n", "Second line\n", "\n", "Third line\n", "Fourth line\n"]
2757
+ # The first argument must be a string that is the path to a file.
2809
2758
  #
2810
2759
  # With only argument `path` given, parses lines from the file at the given
2811
2760
  # `path`, as determined by the default line separator, and returns those lines
@@ -2814,8 +2763,6 @@ class IO < Object
2814
2763
  # IO.readlines('t.txt')
2815
2764
  # # => ["First line\n", "Second line\n", "\n", "Third line\n", "Fourth line\n"]
2816
2765
  #
2817
- # For both forms, command and path, the remaining arguments are the same.
2818
- #
2819
2766
  # With argument `sep` given, parses lines as determined by that line separator
2820
2767
  # (see [Line Separator](rdoc-ref:IO@Line+Separator)):
2821
2768
  #
@@ -2844,7 +2791,7 @@ class IO < Object
2844
2791
  #
2845
2792
  # * [Open Options](rdoc-ref:IO@Open+Options).
2846
2793
  # * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
2847
- # * [Line Options](rdoc-ref:IO@Line+Options).
2794
+ # * [Line Options](rdoc-ref:IO@Line+IO).
2848
2795
  #
2849
2796
  def self.readlines: (String | _ToPath name, ?String sep, ?Integer limit, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) -> ::Array[String]
2850
2797
 
@@ -3022,7 +2969,6 @@ class IO < Object
3022
2969
 
3023
2970
  # <!--
3024
2971
  # rdoc-file=io.c
3025
- # - IO.write(command, data, **opts) -> integer
3026
2972
  # - IO.write(path, data, offset = 0, **opts) -> integer
3027
2973
  # -->
3028
2974
  # Opens the stream, writes the given `data` to it, and closes the stream;
@@ -3032,25 +2978,10 @@ class IO < Object
3032
2978
  # potential security vulnerabilities if called with untrusted input; see
3033
2979
  # [Command Injection](rdoc-ref:command_injection.rdoc).
3034
2980
  #
3035
- # The first argument must be a string; its meaning depends on whether it starts
3036
- # with the pipe character (`'|'`):
3037
- #
3038
- # * If so (and if `self` is IO), the rest of the string is a command to be
3039
- # executed as a subprocess.
3040
- # * Otherwise, the string is the path to a file.
3041
- #
2981
+ # The first argument must be a string that is the path to a file.
3042
2982
  #
3043
- # With argument `command` given, executes the command in a shell, passes `data`
3044
- # through standard input, writes its output to $stdout, and returns the length
3045
- # of the given `data`:
3046
- #
3047
- # IO.write('| cat', 'Hello World!') # => 12
3048
- #
3049
- # Output:
3050
- #
3051
- # Hello World!
3052
- #
3053
- # With argument `path` given, writes the given `data` to the file at that path:
2983
+ # With only argument `path` given, writes the given `data` to the file at that
2984
+ # path:
3054
2985
  #
3055
2986
  # IO.write('t.tmp', 'abc') # => 3
3056
2987
  # File.read('t.tmp') # => "abc"
@@ -3200,8 +3131,6 @@ class IO < Object
3200
3131
  #
3201
3132
  # Returns an Enumerator if no block is given.
3202
3133
  #
3203
- # IO#each is an alias for IO#each_line.
3204
- #
3205
3134
  def each_line: (?String sep, ?Integer limit) { (String line) -> void } -> self
3206
3135
  | (?String sep, ?Integer limit) -> ::Enumerator[String, self]
3207
3136
 
@@ -3307,8 +3236,6 @@ class IO < Object
3307
3236
  #
3308
3237
  # Returns an Enumerator if no block is given.
3309
3238
  #
3310
- # IO#each is an alias for IO#each_line.
3311
- #
3312
3239
  alias each each_line
3313
3240
 
3314
3241
  # <!-- rdoc-file=io.c -->
@@ -3342,8 +3269,6 @@ class IO < Object
3342
3269
  # not behave as you intend with IO#eof?, unless you call IO#rewind first (which
3343
3270
  # is not available for some streams).
3344
3271
  #
3345
- # IO#eof? is an alias for IO#eof.
3346
- #
3347
3272
  alias eof? eof
3348
3273
 
3349
3274
  # <!-- rdoc-file=io.c -->
@@ -3355,8 +3280,6 @@ class IO < Object
3355
3280
  # File.open('t.txt').fileno # => 10
3356
3281
  # f.close
3357
3282
  #
3358
- # IO#to_i is an alias for IO#fileno.
3359
- #
3360
3283
  alias to_i fileno
3361
3284
  end
3362
3285