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.
- checksums.yaml +4 -4
- data/.clang-format +74 -0
- data/.clangd +2 -0
- data/.github/workflows/c-check.yml +54 -0
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +34 -19
- data/.github/workflows/typecheck.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/.gitignore +4 -0
- data/README.md +38 -1
- data/Rakefile +152 -23
- data/config.yml +190 -62
- data/core/array.rbs +44 -43
- data/core/dir.rbs +2 -2
- data/core/encoding.rbs +3 -2
- data/core/enumerable.rbs +89 -2
- data/core/errno.rbs +8 -0
- data/core/errors.rbs +28 -1
- data/core/exception.rbs +2 -2
- data/core/fiber.rbs +3 -3
- data/core/file.rbs +26 -11
- data/core/float.rbs +1 -1
- data/core/gc.rbs +422 -281
- data/core/hash.rbs +1024 -727
- data/core/io/wait.rbs +11 -33
- data/core/io.rbs +6 -4
- data/core/kernel.rbs +49 -43
- data/core/marshal.rbs +1 -1
- data/core/match_data.rbs +1 -1
- data/core/math.rbs +42 -3
- data/core/method.rbs +14 -6
- data/core/module.rbs +71 -11
- data/core/nil_class.rbs +3 -3
- data/core/numeric.rbs +8 -8
- data/core/object.rbs +3 -3
- data/core/object_space.rbs +13 -0
- data/{stdlib/pathname/0 → core}/pathname.rbs +253 -352
- data/core/proc.rbs +15 -8
- data/core/process.rbs +2 -2
- data/core/ractor.rbs +278 -437
- data/core/range.rbs +6 -7
- data/core/rbs/unnamed/argf.rbs +1 -1
- data/core/rbs/unnamed/env_class.rbs +1 -1
- data/core/rbs/unnamed/random.rbs +4 -2
- data/core/regexp.rbs +22 -17
- data/core/ruby_vm.rbs +6 -4
- data/core/rubygems/errors.rbs +3 -70
- data/core/rubygems/rubygems.rbs +11 -79
- data/core/set.rbs +439 -332
- data/core/string.rbs +2897 -1117
- data/core/struct.rbs +1 -1
- data/core/symbol.rbs +4 -4
- data/core/thread.rbs +83 -20
- data/core/time.rbs +35 -9
- data/core/unbound_method.rbs +14 -6
- data/docs/aliases.md +79 -0
- data/docs/collection.md +2 -2
- data/docs/gem.md +0 -1
- data/docs/sigs.md +3 -3
- data/ext/rbs_extension/ast_translation.c +1016 -0
- data/ext/rbs_extension/ast_translation.h +37 -0
- data/ext/rbs_extension/class_constants.c +157 -0
- data/{include/rbs/constants.h → ext/rbs_extension/class_constants.h} +7 -1
- data/ext/rbs_extension/compat.h +10 -0
- data/ext/rbs_extension/extconf.rb +25 -1
- data/ext/rbs_extension/legacy_location.c +317 -0
- data/ext/rbs_extension/legacy_location.h +45 -0
- data/ext/rbs_extension/main.c +365 -14
- data/ext/rbs_extension/rbs_extension.h +6 -21
- data/ext/rbs_extension/rbs_string_bridging.c +9 -0
- data/ext/rbs_extension/rbs_string_bridging.h +24 -0
- data/include/rbs/ast.h +687 -0
- data/include/rbs/defines.h +86 -0
- data/include/rbs/lexer.h +199 -0
- data/include/rbs/location.h +59 -0
- data/include/rbs/parser.h +135 -0
- data/include/rbs/string.h +49 -0
- data/include/rbs/util/rbs_allocator.h +59 -0
- data/include/rbs/util/rbs_assert.h +20 -0
- data/include/rbs/util/rbs_buffer.h +83 -0
- data/include/rbs/util/rbs_constant_pool.h +6 -67
- data/include/rbs/util/rbs_encoding.h +282 -0
- data/include/rbs/util/rbs_unescape.h +23 -0
- data/include/rbs.h +1 -2
- data/lib/rbs/annotate/formatter.rb +3 -13
- data/lib/rbs/annotate/rdoc_annotator.rb +3 -1
- data/lib/rbs/annotate/rdoc_source.rb +1 -1
- data/lib/rbs/cli/validate.rb +2 -2
- data/lib/rbs/cli.rb +1 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +1 -0
- data/lib/rbs/definition_builder/ancestor_builder.rb +5 -5
- data/lib/rbs/environment.rb +64 -59
- data/lib/rbs/environment_loader.rb +1 -1
- data/lib/rbs/errors.rb +1 -1
- data/lib/rbs/parser_aux.rb +5 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +124 -38
- data/lib/rbs/test/type_check.rb +13 -0
- data/lib/rbs/types.rb +3 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -1
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +3 -3
- data/sig/annotate/formatter.rbs +2 -2
- data/sig/annotate/rdoc_annotater.rbs +1 -1
- data/sig/environment.rbs +57 -6
- data/sig/manifest.yaml +0 -1
- data/sig/parser.rbs +20 -0
- data/sig/resolver/type_name_resolver.rbs +38 -7
- data/sig/types.rbs +4 -1
- data/src/ast.c +1256 -0
- data/src/lexer.c +2956 -0
- data/src/lexer.re +147 -0
- data/src/lexstate.c +205 -0
- data/src/location.c +71 -0
- data/src/parser.c +3495 -0
- data/src/string.c +90 -0
- data/src/util/rbs_allocator.c +152 -0
- data/src/util/rbs_assert.c +21 -0
- data/src/util/rbs_buffer.c +54 -0
- data/src/util/rbs_constant_pool.c +16 -86
- data/src/util/rbs_encoding.c +21308 -0
- data/src/util/rbs_unescape.c +131 -0
- data/stdlib/cgi/0/core.rbs +2 -396
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +153 -0
- data/stdlib/coverage/0/coverage.rbs +3 -1
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/erb/0/erb.rbs +737 -347
- data/stdlib/fileutils/0/fileutils.rbs +18 -13
- data/stdlib/forwardable/0/forwardable.rbs +3 -0
- data/stdlib/json/0/json.rbs +67 -48
- data/stdlib/net-http/0/net-http.rbs +3 -0
- data/stdlib/objspace/0/objspace.rbs +8 -3
- data/stdlib/open-uri/0/open-uri.rbs +40 -0
- data/stdlib/openssl/0/openssl.rbs +182 -149
- data/stdlib/optparse/0/optparse.rbs +3 -3
- data/stdlib/rdoc/0/code_object.rbs +2 -2
- data/stdlib/rdoc/0/comment.rbs +2 -0
- data/stdlib/rdoc/0/options.rbs +76 -0
- data/stdlib/rdoc/0/rdoc.rbs +7 -5
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +5 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/socket.rbs +13 -1
- data/stdlib/socket/0/tcp_socket.rbs +10 -2
- data/stdlib/stringio/0/stringio.rbs +412 -80
- data/stdlib/strscan/0/string_scanner.rbs +31 -31
- data/stdlib/tempfile/0/tempfile.rbs +1 -1
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/uri/0/common.rbs +11 -2
- data/stdlib/uri/0/file.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +16 -15
- data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +41 -18
- data/ext/rbs_extension/lexer.c +0 -2728
- data/ext/rbs_extension/lexer.h +0 -179
- data/ext/rbs_extension/lexer.re +0 -147
- data/ext/rbs_extension/lexstate.c +0 -175
- data/ext/rbs_extension/location.c +0 -325
- data/ext/rbs_extension/location.h +0 -85
- data/ext/rbs_extension/parser.c +0 -2982
- data/ext/rbs_extension/parser.h +0 -18
- data/ext/rbs_extension/parserstate.c +0 -411
- data/ext/rbs_extension/parserstate.h +0 -163
- data/ext/rbs_extension/unescape.c +0 -32
- data/include/rbs/ruby_objs.h +0 -72
- data/src/constants.c +0 -153
- 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.
|
|
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
|
-
#
|
|
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
|
data/core/rbs/unnamed/argf.rbs
CHANGED
|
@@ -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:
|
|
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.
|
data/core/rbs/unnamed/random.rbs
CHANGED
|
@@ -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)
|
|
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 "
|
|
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
|
|
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
|
|
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
|
|
1281
|
+
# Read:
|
|
1276
1282
|
#
|
|
1277
|
-
# *
|
|
1278
|
-
#
|
|
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
|
|
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
|
-
# -
|
|
1663
|
+
# - encoding -> encoding
|
|
1662
1664
|
# -->
|
|
1663
|
-
# Returns
|
|
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: (
|
|
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. `
|
|
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.
|
data/core/rubygems/errors.rbs
CHANGED
|
@@ -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/
|
|
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/
|
|
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
|
data/core/rubygems/rubygems.rbs
CHANGED
|
@@ -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/
|
|
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/
|
|
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
|
|
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?
|