rbs 3.9.5 → 3.10.0.pre.1

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.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +74 -0
  3. data/.clangd +2 -0
  4. data/.github/workflows/c-check.yml +54 -0
  5. data/.github/workflows/comments.yml +3 -3
  6. data/.github/workflows/ruby.yml +34 -19
  7. data/.github/workflows/typecheck.yml +1 -1
  8. data/.github/workflows/windows.yml +1 -1
  9. data/.gitignore +4 -0
  10. data/README.md +38 -1
  11. data/Rakefile +152 -23
  12. data/config.yml +190 -62
  13. data/core/array.rbs +44 -43
  14. data/core/dir.rbs +2 -2
  15. data/core/encoding.rbs +3 -2
  16. data/core/enumerable.rbs +89 -2
  17. data/core/errno.rbs +8 -0
  18. data/core/errors.rbs +28 -1
  19. data/core/exception.rbs +2 -2
  20. data/core/fiber.rbs +3 -3
  21. data/core/file.rbs +26 -11
  22. data/core/float.rbs +1 -1
  23. data/core/gc.rbs +422 -281
  24. data/core/hash.rbs +1024 -727
  25. data/core/io/wait.rbs +11 -33
  26. data/core/io.rbs +6 -4
  27. data/core/kernel.rbs +49 -43
  28. data/core/marshal.rbs +1 -1
  29. data/core/match_data.rbs +1 -1
  30. data/core/math.rbs +42 -3
  31. data/core/method.rbs +14 -6
  32. data/core/module.rbs +71 -11
  33. data/core/nil_class.rbs +3 -3
  34. data/core/numeric.rbs +8 -8
  35. data/core/object.rbs +3 -3
  36. data/core/object_space.rbs +13 -0
  37. data/{stdlib/pathname/0 → core}/pathname.rbs +253 -352
  38. data/core/proc.rbs +15 -8
  39. data/core/process.rbs +2 -2
  40. data/core/ractor.rbs +278 -437
  41. data/core/range.rbs +6 -7
  42. data/core/rbs/unnamed/argf.rbs +1 -1
  43. data/core/rbs/unnamed/env_class.rbs +1 -1
  44. data/core/rbs/unnamed/random.rbs +4 -2
  45. data/core/regexp.rbs +22 -17
  46. data/core/ruby_vm.rbs +6 -4
  47. data/core/rubygems/errors.rbs +3 -70
  48. data/core/rubygems/rubygems.rbs +11 -79
  49. data/core/set.rbs +439 -332
  50. data/core/string.rbs +2897 -1117
  51. data/core/struct.rbs +1 -1
  52. data/core/symbol.rbs +4 -4
  53. data/core/thread.rbs +83 -20
  54. data/core/time.rbs +35 -9
  55. data/core/unbound_method.rbs +14 -6
  56. data/docs/aliases.md +79 -0
  57. data/docs/collection.md +2 -2
  58. data/docs/gem.md +0 -1
  59. data/docs/sigs.md +3 -3
  60. data/ext/rbs_extension/ast_translation.c +1016 -0
  61. data/ext/rbs_extension/ast_translation.h +37 -0
  62. data/ext/rbs_extension/class_constants.c +157 -0
  63. data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +7 -1
  64. data/ext/rbs_extension/compat.h +10 -0
  65. data/ext/rbs_extension/extconf.rb +25 -1
  66. data/ext/rbs_extension/legacy_location.c +317 -0
  67. data/ext/rbs_extension/legacy_location.h +45 -0
  68. data/ext/rbs_extension/main.c +365 -14
  69. data/ext/rbs_extension/rbs_extension.h +6 -21
  70. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  71. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  72. data/include/rbs/ast.h +687 -0
  73. data/include/rbs/defines.h +86 -0
  74. data/include/rbs/lexer.h +199 -0
  75. data/include/rbs/location.h +59 -0
  76. data/include/rbs/parser.h +135 -0
  77. data/include/rbs/string.h +49 -0
  78. data/include/rbs/util/rbs_allocator.h +59 -0
  79. data/include/rbs/util/rbs_assert.h +20 -0
  80. data/include/rbs/util/rbs_buffer.h +83 -0
  81. data/include/rbs/util/rbs_constant_pool.h +6 -67
  82. data/include/rbs/util/rbs_encoding.h +282 -0
  83. data/include/rbs/util/rbs_unescape.h +23 -0
  84. data/include/rbs.h +1 -2
  85. data/lib/rbs/annotate/formatter.rb +3 -13
  86. data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
  87. data/lib/rbs/annotate/rdoc_source.rb +1 -1
  88. data/lib/rbs/cli/validate.rb +2 -2
  89. data/lib/rbs/cli.rb +1 -1
  90. data/lib/rbs/collection/config/lockfile_generator.rb +1 -0
  91. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -5
  92. data/lib/rbs/environment.rb +64 -59
  93. data/lib/rbs/environment_loader.rb +1 -1
  94. data/lib/rbs/errors.rb +1 -1
  95. data/lib/rbs/parser_aux.rb +5 -0
  96. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  97. data/lib/rbs/resolver/type_name_resolver.rb +124 -38
  98. data/lib/rbs/test/type_check.rb +13 -0
  99. data/lib/rbs/types.rb +3 -1
  100. data/lib/rbs/version.rb +1 -1
  101. data/lib/rbs.rb +1 -1
  102. data/lib/rdoc/discover.rb +1 -1
  103. data/lib/rdoc_plugin/parser.rb +3 -3
  104. data/sig/annotate/formatter.rbs +2 -2
  105. data/sig/annotate/rdoc_annotater.rbs +1 -1
  106. data/sig/environment.rbs +57 -6
  107. data/sig/manifest.yaml +0 -1
  108. data/sig/parser.rbs +20 -0
  109. data/sig/resolver/type_name_resolver.rbs +38 -7
  110. data/sig/types.rbs +4 -1
  111. data/src/ast.c +1256 -0
  112. data/src/lexer.c +2956 -0
  113. data/src/lexer.re +147 -0
  114. data/src/lexstate.c +205 -0
  115. data/src/location.c +71 -0
  116. data/src/parser.c +3495 -0
  117. data/src/string.c +90 -0
  118. data/src/util/rbs_allocator.c +152 -0
  119. data/src/util/rbs_assert.c +21 -0
  120. data/src/util/rbs_buffer.c +54 -0
  121. data/src/util/rbs_constant_pool.c +16 -86
  122. data/src/util/rbs_encoding.c +21308 -0
  123. data/src/util/rbs_unescape.c +131 -0
  124. data/stdlib/cgi/0/core.rbs +2 -396
  125. data/stdlib/cgi/0/manifest.yaml +1 -0
  126. data/stdlib/cgi-escape/0/escape.rbs +153 -0
  127. data/stdlib/coverage/0/coverage.rbs +3 -1
  128. data/stdlib/delegate/0/delegator.rbs +10 -7
  129. data/stdlib/erb/0/erb.rbs +737 -347
  130. data/stdlib/fileutils/0/fileutils.rbs +18 -13
  131. data/stdlib/forwardable/0/forwardable.rbs +3 -0
  132. data/stdlib/json/0/json.rbs +67 -48
  133. data/stdlib/net-http/0/net-http.rbs +3 -0
  134. data/stdlib/objspace/0/objspace.rbs +8 -3
  135. data/stdlib/open-uri/0/open-uri.rbs +40 -0
  136. data/stdlib/openssl/0/openssl.rbs +182 -149
  137. data/stdlib/optparse/0/optparse.rbs +3 -3
  138. data/stdlib/rdoc/0/code_object.rbs +2 -2
  139. data/stdlib/rdoc/0/comment.rbs +2 -0
  140. data/stdlib/rdoc/0/options.rbs +76 -0
  141. data/stdlib/rdoc/0/rdoc.rbs +7 -5
  142. data/stdlib/rdoc/0/store.rbs +1 -1
  143. data/stdlib/resolv/0/resolv.rbs +25 -68
  144. data/stdlib/ripper/0/ripper.rbs +5 -2
  145. data/stdlib/singleton/0/singleton.rbs +3 -0
  146. data/stdlib/socket/0/socket.rbs +13 -1
  147. data/stdlib/socket/0/tcp_socket.rbs +10 -2
  148. data/stdlib/stringio/0/stringio.rbs +412 -80
  149. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  150. data/stdlib/tempfile/0/tempfile.rbs +1 -1
  151. data/stdlib/tsort/0/cyclic.rbs +3 -0
  152. data/stdlib/uri/0/common.rbs +11 -2
  153. data/stdlib/uri/0/file.rbs +1 -1
  154. data/stdlib/uri/0/generic.rbs +16 -15
  155. data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
  156. data/stdlib/zlib/0/zstream.rbs +1 -0
  157. metadata +41 -18
  158. data/ext/rbs_extension/lexer.c +0 -2728
  159. data/ext/rbs_extension/lexer.h +0 -179
  160. data/ext/rbs_extension/lexer.re +0 -147
  161. data/ext/rbs_extension/lexstate.c +0 -175
  162. data/ext/rbs_extension/location.c +0 -325
  163. data/ext/rbs_extension/location.h +0 -85
  164. data/ext/rbs_extension/parser.c +0 -2982
  165. data/ext/rbs_extension/parser.h +0 -18
  166. data/ext/rbs_extension/parserstate.c +0 -411
  167. data/ext/rbs_extension/parserstate.h +0 -163
  168. data/ext/rbs_extension/unescape.c +0 -32
  169. data/include/rbs/ruby_objs.h +0 -72
  170. data/src/constants.c +0 -153
  171. data/src/ruby_objs.c +0 -799
data/core/range.rbs CHANGED
@@ -86,14 +86,14 @@
86
86
  # end
87
87
  # a # => [2, 4, 6, 8, 10]
88
88
  #
89
- # A range can be both beginless and endless. For literal beginless, endless
89
+ # A range can be both beginless and endless. For literal beginless, endless
90
90
  # ranges, at least the beginning or end of the range must be given as an
91
91
  # explicit nil value. It is recommended to use an explicit nil beginning and
92
- # implicit nil end, since that is what Ruby uses for Range#inspect:
92
+ # end, since that is what Ruby uses for Range#inspect:
93
93
  #
94
- # (nil..) # => (nil..)
95
- # (..nil) # => (nil..)
96
- # (nil..nil) # => (nil..)
94
+ # (nil..) # => (nil..nil)
95
+ # (..nil) # => (nil..nil)
96
+ # (nil..nil) # => (nil..nil)
97
97
  #
98
98
  # ## Ranges and Other Classes
99
99
  #
@@ -936,8 +936,7 @@ class Range[out Elem] < Object
936
936
  #
937
937
  # Related: Range#count.
938
938
  #
939
- def size: () -> Integer?
940
- | () -> Float?
939
+ def size: () -> (Integer | Float | nil)
941
940
 
942
941
  # <!--
943
942
  # rdoc-file=range.c
@@ -93,7 +93,7 @@ module RBS
93
93
  # * File `t.rb`:
94
94
  #
95
95
  # p "ARGV: #{ARGV}"
96
- # p "Line: #{ARGF.read}" # Read everything from all specified streams.
96
+ # p "Read: #{ARGF.read}" # Read everything from all specified streams.
97
97
  #
98
98
  # * Command and output:
99
99
  #
@@ -140,7 +140,7 @@ module RBS
140
140
  #
141
141
  # * ::assoc: Returns a 2-element array containing the name and value of the
142
142
  # named environment variable if it exists:
143
- # * ::clone: Returns `ENV` (and issues a warning).
143
+ # * ::clone: Raises an exception.
144
144
  # * ::except: Returns a hash of all name/value pairs except those given.
145
145
  # * ::fetch: Returns the value for the given name.
146
146
  # * ::inspect: Returns the contents of `ENV` as a string.
@@ -31,9 +31,11 @@ module RBS
31
31
  # prng.rand(100) # => 42
32
32
  #
33
33
  # When `max` is a Float, `rand` returns a random floating point number between
34
- # 0.0 and `max`, including 0.0 and excluding `max`.
34
+ # 0.0 and `max`, including 0.0 and excluding `max`. Note that it behaves
35
+ # differently from Kernel.rand.
35
36
  #
36
- # prng.rand(1.5) # => 1.4600282860034115
37
+ # prng.rand(1.5) # => 1.4600282860034115
38
+ # rand(1.5) # => 0
37
39
  #
38
40
  # When `range` is a Range, `rand` returns a random number where
39
41
  # `range.member?(number) == true`.
data/core/regexp.rbs CHANGED
@@ -126,6 +126,9 @@
126
126
  # `nil`. Note that `$0` is quite different; it returns the name of the
127
127
  # currently executing program.
128
128
  #
129
+ # These variables, except for `$~`, are shorthands for methods of `$~`. See
130
+ # MatchData@Global+variables+equivalence.
131
+ #
129
132
  # Examples:
130
133
  #
131
134
  # # Matched string, but no matched groups.
@@ -435,6 +438,9 @@
435
438
  # /(?<=<b>)\w+(?=<\/b>)/.match("Fortune favors the <b>bold</b>.")
436
439
  # # => #<MatchData "bold">
437
440
  #
441
+ # The pattern in lookbehind must be fixed-width. But top-level alternatives can
442
+ # be of various lengths. ex. (?<=a|bc) is OK. (?<=aaa(?:b|cd)) is not allowed.
443
+ #
438
444
  # #### Match-Reset Anchor
439
445
  #
440
446
  # * `\K`: Match reset: the matched content preceding `\K` in the regexp is
@@ -495,7 +501,7 @@
495
501
  # /\w*/.match('x')
496
502
  # # => #<MatchData "x">
497
503
  # /\w*/.match('xyz')
498
- # # => #<MatchData "yz">
504
+ # # => #<MatchData "xyz">
499
505
  #
500
506
  # * `+` - Matches one or more times:
501
507
  #
@@ -708,7 +714,7 @@
708
714
  #
709
715
  # 1. The leading subexpression `"` in the pattern matches the first character
710
716
  # `"` in the target string.
711
- # 2. The next subexpression `.*` matches the next substring `Quote“` (including
717
+ # 2. The next subexpression `.*` matches the next substring `Quote"` (including
712
718
  # the trailing double-quote).
713
719
  # 3. Now there is nothing left in the target string to match the trailing
714
720
  # subexpression `"` in the pattern; this would cause the overall match to
@@ -1248,7 +1254,7 @@
1248
1254
  #
1249
1255
  # Regexp matching can apply an optimization to prevent ReDoS attacks. When the
1250
1256
  # optimization is applied, matching time increases linearly (not polynomially or
1251
- # exponentially) in relation to the input size, and a ReDoS attach is not
1257
+ # exponentially) in relation to the input size, and a ReDoS attack is not
1252
1258
  # possible.
1253
1259
  #
1254
1260
  # This optimization is applied if the pattern meets these criteria:
@@ -1272,21 +1278,14 @@
1272
1278
  #
1273
1279
  # ## References
1274
1280
  #
1275
- # Read (online PDF books):
1281
+ # Read:
1276
1282
  #
1277
- # * [Mastering Regular
1278
- # Expressions](https://ia902508.us.archive.org/10/items/allitebooks-02/Maste
1279
- # ring%20Regular%20Expressions%2C%203rd%20Edition.pdf) by Jeffrey E.F.
1280
- # Friedl.
1281
- # * [Regular Expressions
1282
- # Cookbook](https://doc.lagout.org/programmation/Regular%20Expressions/Regul
1283
- # ar%20Expressions%20Cookbook_%20Detailed%20Solutions%20in%20Eight%20Program
1284
- # ming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-
1285
- # 09-06%5D.pdf) by Jan Goyvaerts & Steven Levithan.
1283
+ # * *Mastering Regular Expressions* by Jeffrey E.F. Friedl.
1284
+ # * *Regular Expressions Cookbook* by Jan Goyvaerts & Steven Levithan.
1286
1285
  #
1287
- # Explore, test (interactive online editor):
1286
+ # Explore, test:
1288
1287
  #
1289
- # * [Rubular](https://rubular.com/).
1288
+ # * [Rubular](https://rubular.com/): interactive online editor.
1290
1289
  #
1291
1290
  class Regexp
1292
1291
  # Represents an object's ability to be converted to a `Regexp`.
@@ -1297,6 +1296,9 @@ class Regexp
1297
1296
  def to_regexp: () -> Regexp
1298
1297
  end
1299
1298
 
1299
+ # <!-- rdoc-file=re.c -->
1300
+ # Raised when regexp matching timed out.
1301
+ #
1300
1302
  class TimeoutError < RegexpError
1301
1303
  end
1302
1304
 
@@ -1658,9 +1660,12 @@ class Regexp
1658
1660
 
1659
1661
  # <!--
1660
1662
  # rdoc-file=re.c
1661
- # - obj.encoding -> encoding
1663
+ # - encoding -> encoding
1662
1664
  # -->
1663
- # Returns the Encoding object that represents the encoding of obj.
1665
+ # Returns an Encoding object that represents the encoding of `self`; see
1666
+ # [Encodings](rdoc-ref:encodings.rdoc).
1667
+ #
1668
+ # Related: see [Querying](rdoc-ref:String@Querying).
1664
1669
  #
1665
1670
  def encoding: () -> Encoding
1666
1671
 
data/core/ruby_vm.rbs CHANGED
@@ -443,7 +443,7 @@ module RubyVM::AbstractSyntaxTree
443
443
  #
444
444
  # See ::parse for explanation of keyword argument meaning and usage.
445
445
  #
446
- def self.parse_file: (String | ::_ToPath string, ?keep_script_lines: bool, ?error_tolerant: bool, ?keep_tokens: bool) -> Node
446
+ def self.parse_file: (path string, ?keep_script_lines: bool, ?error_tolerant: bool, ?keep_tokens: bool) -> Node
447
447
 
448
448
  # <!--
449
449
  # rdoc-file=ast.rb
@@ -683,11 +683,13 @@ module RubyVM::YJIT
683
683
 
684
684
  # <!--
685
685
  # rdoc-file=yjit.rb
686
- # - enable(stats: false, log: false)
686
+ # - enable(stats: false, log: false, mem_size: nil, call_threshold: nil)
687
687
  # -->
688
688
  # Enable YJIT compilation. `stats` option decides whether to enable YJIT stats
689
- # or not. `compilation_log` decides
690
- # whether to enable YJIT compilation logging or not.
689
+ # or not. `log` decides
690
+ # whether to enable YJIT compilation logging or not. Optional `mem_size` and
691
+ # `call_threshold` can be
692
+ # provided to override default configuration.
691
693
  # * `stats`:
692
694
  # * `false`: Don't enable stats.
693
695
  # * `true`: Enable stats. Print stats at exit.
@@ -17,7 +17,7 @@
17
17
  # Further RubyGems documentation can be found at:
18
18
  #
19
19
  # * [RubyGems Guides](https://guides.rubygems.org)
20
- # * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
20
+ # * [RubyGems API](https://www.rubydoc.info/github/ruby/rubygems) (also
21
21
  # available from `gem server`)
22
22
  #
23
23
  # ## RubyGems Plugins
@@ -48,7 +48,7 @@
48
48
  # ## Bugs
49
49
  #
50
50
  # You can submit bugs to the [RubyGems bug
51
- # tracker](https://github.com/rubygems/rubygems/issues) on GitHub
51
+ # tracker](https://github.com/ruby/rubygems/issues) on GitHub
52
52
  #
53
53
  # ## Credits
54
54
  #
@@ -83,80 +83,13 @@
83
83
  #
84
84
  # ## License
85
85
  #
86
- # See
87
- # [LICENSE.txt](https://github.com/rubygems/rubygems/blob/master/LICENSE.txt)
86
+ # See [LICENSE.txt](https://github.com/ruby/rubygems/blob/master/LICENSE.txt)
88
87
  # for permissions.
89
88
  #
90
89
  # Thanks!
91
90
  #
92
91
  # -The RubyGems Team
93
92
  #
94
- # <!-- rdoc-file=lib/rubygems/deprecate.rb -->
95
- # Provides 3 methods for declaring when something is going away.
96
- #
97
- # +deprecate(name, repl, year, month)+:
98
- # Indicate something may be removed on/after a certain date.
99
- #
100
- # +rubygems_deprecate(name, replacement=:none)+:
101
- # Indicate something will be removed in the next major RubyGems version,
102
- # and (optionally) a replacement for it.
103
- #
104
- # `rubygems_deprecate_command`:
105
- # Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
106
- # removed in the next RubyGems version.
107
- #
108
- # Also provides `skip_during` for temporarily turning off deprecation warnings.
109
- # This is intended to be used in the test suite, so deprecation warnings don't
110
- # cause test failures if you need to make sure stderr is otherwise empty.
111
- #
112
- # Example usage of `deprecate` and `rubygems_deprecate`:
113
- #
114
- # class Legacy
115
- # def self.some_class_method
116
- # # ...
117
- # end
118
- #
119
- # def some_instance_method
120
- # # ...
121
- # end
122
- #
123
- # def some_old_method
124
- # # ...
125
- # end
126
- #
127
- # extend Gem::Deprecate
128
- # deprecate :some_instance_method, "X.z", 2011, 4
129
- # rubygems_deprecate :some_old_method, "Modern#some_new_method"
130
- #
131
- # class << self
132
- # extend Gem::Deprecate
133
- # deprecate :some_class_method, :none, 2011, 4
134
- # end
135
- # end
136
- #
137
- # Example usage of `rubygems_deprecate_command`:
138
- #
139
- # class Gem::Commands::QueryCommand < Gem::Command
140
- # extend Gem::Deprecate
141
- # rubygems_deprecate_command
142
- #
143
- # # ...
144
- # end
145
- #
146
- # Example usage of `skip_during`:
147
- #
148
- # class TestSomething < Gem::Testcase
149
- # def test_some_thing_with_deprecations
150
- # Gem::Deprecate.skip_during do
151
- # actual_stdout, actual_stderr = capture_output do
152
- # Gem.something_deprecated
153
- # end
154
- # assert_empty actual_stdout
155
- # assert_equal(expected, actual_stderr)
156
- # end
157
- # end
158
- # end
159
- #
160
93
  module Gem
161
94
  # <!-- rdoc-file=lib/rubygems/errors.rb -->
162
95
  # Raised when RubyGems is unable to load or activate a gem. Contains the name
@@ -17,7 +17,7 @@
17
17
  # Further RubyGems documentation can be found at:
18
18
  #
19
19
  # * [RubyGems Guides](https://guides.rubygems.org)
20
- # * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
20
+ # * [RubyGems API](https://www.rubydoc.info/github/ruby/rubygems) (also
21
21
  # available from `gem server`)
22
22
  #
23
23
  # ## RubyGems Plugins
@@ -48,7 +48,7 @@
48
48
  # ## Bugs
49
49
  #
50
50
  # You can submit bugs to the [RubyGems bug
51
- # tracker](https://github.com/rubygems/rubygems/issues) on GitHub
51
+ # tracker](https://github.com/ruby/rubygems/issues) on GitHub
52
52
  #
53
53
  # ## Credits
54
54
  #
@@ -83,80 +83,13 @@
83
83
  #
84
84
  # ## License
85
85
  #
86
- # See
87
- # [LICENSE.txt](https://github.com/rubygems/rubygems/blob/master/LICENSE.txt)
86
+ # See [LICENSE.txt](https://github.com/ruby/rubygems/blob/master/LICENSE.txt)
88
87
  # for permissions.
89
88
  #
90
89
  # Thanks!
91
90
  #
92
91
  # -The RubyGems Team
93
92
  #
94
- # <!-- rdoc-file=lib/rubygems/deprecate.rb -->
95
- # Provides 3 methods for declaring when something is going away.
96
- #
97
- # +deprecate(name, repl, year, month)+:
98
- # Indicate something may be removed on/after a certain date.
99
- #
100
- # +rubygems_deprecate(name, replacement=:none)+:
101
- # Indicate something will be removed in the next major RubyGems version,
102
- # and (optionally) a replacement for it.
103
- #
104
- # `rubygems_deprecate_command`:
105
- # Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
106
- # removed in the next RubyGems version.
107
- #
108
- # Also provides `skip_during` for temporarily turning off deprecation warnings.
109
- # This is intended to be used in the test suite, so deprecation warnings don't
110
- # cause test failures if you need to make sure stderr is otherwise empty.
111
- #
112
- # Example usage of `deprecate` and `rubygems_deprecate`:
113
- #
114
- # class Legacy
115
- # def self.some_class_method
116
- # # ...
117
- # end
118
- #
119
- # def some_instance_method
120
- # # ...
121
- # end
122
- #
123
- # def some_old_method
124
- # # ...
125
- # end
126
- #
127
- # extend Gem::Deprecate
128
- # deprecate :some_instance_method, "X.z", 2011, 4
129
- # rubygems_deprecate :some_old_method, "Modern#some_new_method"
130
- #
131
- # class << self
132
- # extend Gem::Deprecate
133
- # deprecate :some_class_method, :none, 2011, 4
134
- # end
135
- # end
136
- #
137
- # Example usage of `rubygems_deprecate_command`:
138
- #
139
- # class Gem::Commands::QueryCommand < Gem::Command
140
- # extend Gem::Deprecate
141
- # rubygems_deprecate_command
142
- #
143
- # # ...
144
- # end
145
- #
146
- # Example usage of `skip_during`:
147
- #
148
- # class TestSomething < Gem::Testcase
149
- # def test_some_thing_with_deprecations
150
- # Gem::Deprecate.skip_during do
151
- # actual_stdout, actual_stderr = capture_output do
152
- # Gem.something_deprecated
153
- # end
154
- # assert_empty actual_stdout
155
- # assert_equal(expected, actual_stderr)
156
- # end
157
- # end
158
- # end
159
- #
160
93
  module Gem
161
94
  interface _HashLike[K, V]
162
95
  def each_pair: () { ([ K, V ]) -> untyped } -> self
@@ -204,7 +137,7 @@ module Gem
204
137
 
205
138
  VERSION: String
206
139
 
207
- # <!-- rdoc-file=lib/rubygems.rb -->
140
+ # <!-- rdoc-file=lib/rubygems/win_platform.rb -->
208
141
  # An Array of Regexps that match windows Ruby platforms.
209
142
  #
210
143
  WIN_PATTERNS: Array[Regexp]
@@ -251,7 +184,7 @@ module Gem
251
184
 
252
185
  # <!--
253
186
  # rdoc-file=lib/rubygems.rb
254
- # - bindir(install_dir=Gem.dir)
187
+ # - bindir(install_dir = Gem.dir)
255
188
  # -->
256
189
  # The path where gem executables are to be installed.
257
190
  #
@@ -509,7 +442,7 @@ module Gem
509
442
 
510
443
  # <!--
511
444
  # rdoc-file=lib/rubygems.rb
512
- # - find_files(glob, check_load_path=true)
445
+ # - find_files(glob, check_load_path = true)
513
446
  # -->
514
447
  # Returns a list of paths matching `glob` that can be used by a gem to pick up
515
448
  # features from other gems. For example:
@@ -526,7 +459,7 @@ module Gem
526
459
 
527
460
  # <!--
528
461
  # rdoc-file=lib/rubygems.rb
529
- # - find_latest_files(glob, check_load_path=true)
462
+ # - find_latest_files(glob, check_load_path = true)
530
463
  # -->
531
464
  # Returns a list of paths matching `glob` from the latest gems that can be used
532
465
  # by a gem to pick up features from other gems. For example:
@@ -551,7 +484,7 @@ module Gem
551
484
 
552
485
  # <!--
553
486
  # rdoc-file=lib/rubygems.rb
554
- # - finish_resolve(request_set=Gem::RequestSet.new)
487
+ # - finish_resolve(request_set = Gem::RequestSet.new)
555
488
  # -->
556
489
  #
557
490
  def self.finish_resolve: (?RequestSet request_set) -> void
@@ -804,7 +737,7 @@ module Gem
804
737
 
805
738
  # <!--
806
739
  # rdoc-file=lib/rubygems.rb
807
- # - plugindir(install_dir=Gem.dir)
740
+ # - plugindir(install_dir = Gem.dir)
808
741
  # -->
809
742
  # The path were rubygems plugins are to be installed.
810
743
  #
@@ -1009,8 +942,7 @@ module Gem
1009
942
  # - source_date_epoch_string()
1010
943
  # -->
1011
944
  # If the SOURCE_DATE_EPOCH environment variable is set, returns it's value.
1012
- # Otherwise, returns the time that `Gem.source_date_epoch_string` was first
1013
- # called in the same format as SOURCE_DATE_EPOCH.
945
+ # Otherwise, returns DEFAULT_SOURCE_DATE_EPOCH as a string.
1014
946
  #
1015
947
  # NOTE(@duckinator): The implementation is a tad weird because we want to:
1016
948
  # 1. Make builds reproducible by default, by having this function always
@@ -1154,7 +1086,7 @@ module Gem
1154
1086
  def self.user_home: () -> String
1155
1087
 
1156
1088
  # <!--
1157
- # rdoc-file=lib/rubygems.rb
1089
+ # rdoc-file=lib/rubygems/win_platform.rb
1158
1090
  # - win_platform?()
1159
1091
  # -->
1160
1092
  # Is this a windows platform?