rbs 1.0.3 → 1.1.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -2
  3. data/CHANGELOG.md +65 -0
  4. data/Gemfile +0 -1
  5. data/Rakefile +3 -2
  6. data/Steepfile +2 -0
  7. data/bin/rbs-prof +1 -1
  8. data/core/array.rbs +10 -6
  9. data/core/complex.rbs +1 -1
  10. data/core/enumerable.rbs +15 -1
  11. data/core/enumerator.rbs +4 -0
  12. data/core/file.rbs +2 -1
  13. data/core/integer.rbs +2 -1
  14. data/core/module.rbs +1 -1
  15. data/core/rational.rbs +2 -1
  16. data/core/string.rbs +2 -1
  17. data/core/symbol.rbs +2 -1
  18. data/core/thread.rbs +14 -1
  19. data/core/time.rbs +2 -1
  20. data/docs/stdlib.md +1 -1
  21. data/lib/rbs.rb +3 -0
  22. data/lib/rbs/ancestor_graph.rb +90 -0
  23. data/lib/rbs/ast/members.rb +13 -0
  24. data/lib/rbs/char_scanner.rb +20 -0
  25. data/lib/rbs/definition_builder.rb +50 -25
  26. data/lib/rbs/definition_builder/method_builder.rb +23 -2
  27. data/lib/rbs/environment.rb +42 -5
  28. data/lib/rbs/environment_walker.rb +4 -4
  29. data/lib/rbs/errors.rb +32 -17
  30. data/lib/rbs/parser.rb +437 -416
  31. data/lib/rbs/parser.y +29 -16
  32. data/lib/rbs/test/type_check.rb +7 -3
  33. data/lib/rbs/version.rb +1 -1
  34. data/sig/ancestor_graph.rbs +40 -0
  35. data/sig/char_scanner.rbs +9 -0
  36. data/sig/definition_builder.rbs +5 -1
  37. data/sig/environment.rbs +22 -2
  38. data/sig/environment_walker.rbs +39 -0
  39. data/sig/errors.rbs +42 -17
  40. data/sig/members.rbs +2 -0
  41. data/sig/method_builder.rbs +2 -0
  42. data/sig/parser.rbs +11 -4
  43. data/sig/polyfill.rbs +0 -14
  44. data/sig/types.rbs +7 -1
  45. data/stdlib/bigdecimal/0/big_decimal.rbs +1 -1
  46. data/stdlib/cgi/0/core.rbs +595 -0
  47. data/stdlib/date/0/date.rbs +1 -1
  48. data/stdlib/json/0/json.rbs +288 -0
  49. data/stdlib/pathname/0/pathname.rbs +2 -1
  50. data/stdlib/rubygems/0/basic_specification.rbs +3 -0
  51. data/stdlib/rubygems/0/config_file.rbs +3 -0
  52. data/stdlib/rubygems/0/dependency_installer.rbs +5 -0
  53. data/stdlib/rubygems/0/installer.rbs +3 -0
  54. data/stdlib/rubygems/0/path_support.rbs +3 -0
  55. data/stdlib/rubygems/0/platform.rbs +3 -0
  56. data/stdlib/rubygems/0/request_set.rbs +7 -0
  57. data/stdlib/rubygems/0/requirement.rbs +3 -0
  58. data/stdlib/rubygems/0/rubygems.rbs +710 -0
  59. data/stdlib/rubygems/0/source_list.rbs +2 -0
  60. data/stdlib/rubygems/0/specification.rbs +3 -0
  61. data/stdlib/rubygems/0/stream_ui.rbs +3 -0
  62. data/stdlib/rubygems/0/uninstaller.rbs +3 -0
  63. data/stdlib/rubygems/0/version.rbs +228 -0
  64. data/stdlib/set/0/set.rbs +7 -0
  65. data/stdlib/strscan/0/string_scanner.rbs +582 -0
  66. data/stdlib/timeout/0/timeout.rbs +57 -0
  67. data/stdlib/uri/0/rfc2396_parser.rbs +144 -7
  68. data/steep/Gemfile.lock +17 -19
  69. metadata +24 -2
@@ -496,7 +496,7 @@ class Date
496
496
  #
497
497
  # See also Comparable.
498
498
  #
499
- def <=>: (Date | Rational | Object other) -> Integer?
499
+ def <=>: (untyped other) -> Integer?
500
500
 
501
501
  # Returns true if they are the same day.
502
502
  #
@@ -339,3 +339,291 @@ JSON::VERSION_BUILD: Integer
339
339
  JSON::VERSION_MAJOR: Integer
340
340
 
341
341
  JSON::VERSION_MINOR: Integer
342
+
343
+ class Object
344
+ # Converts this object to a string (calling #to_s), converts
345
+ # it to a JSON string, and returns the result. This is a fallback, if no
346
+ # special method #to_json was defined for some object.
347
+ #
348
+ def to_json: (?JSON::State state) -> String
349
+ end
350
+
351
+ class NilClass
352
+ # Returns a JSON string for nil: 'null'.
353
+ #
354
+ def to_json: (?JSON::State state) -> String
355
+ end
356
+
357
+ class TrueClass
358
+ # Returns a JSON string for true: 'true'.
359
+ #
360
+ def to_json: (?JSON::State state) -> String
361
+ end
362
+
363
+ class FalseClass
364
+ # Returns a JSON string for false: 'false'.
365
+ #
366
+ def to_json: (?JSON::State state) -> String
367
+ end
368
+
369
+ class String
370
+ # This string should be encoded with UTF-8 A call to this method
371
+ # returns a JSON string encoded with UTF16 big endian characters as
372
+ # \u????.
373
+ #
374
+ def to_json: (?JSON::State state) -> String
375
+ end
376
+
377
+ class Integer
378
+ # Returns a JSON string representation for this Integer number.
379
+ #
380
+ def to_json: (?JSON::State state) -> String
381
+ end
382
+
383
+ class Float
384
+ # Returns a JSON string representation for this Float number.
385
+ #
386
+ def to_json: (?JSON::State state) -> String
387
+ end
388
+
389
+ class Hash[unchecked out K, unchecked out V]
390
+ # Returns a JSON string containing a JSON object, that is generated from
391
+ # this Hash instance.
392
+ # _state_ is a JSON::State object, that can also be used to configure the
393
+ # produced JSON string output further.
394
+ #
395
+ def to_json: (?JSON::State state) -> String
396
+ end
397
+
398
+ class Array[unchecked out Elem]
399
+ # Returns a JSON string containing a JSON array, that is generated from
400
+ # this Array instance.
401
+ # _state_ is a JSON::State object, that can also be used to configure the
402
+ # produced JSON string output further.
403
+ #
404
+ def to_json: (?JSON::State state) -> String
405
+ end
406
+
407
+ class BigDecimal
408
+ # Import a JSON Marshalled object.
409
+ #
410
+ # method used for JSON marshalling support.
411
+ #
412
+ def self.json_create: (Hash[String, String] object) -> instance
413
+
414
+ # Marshal the object to JSON.
415
+ #
416
+ # method used for JSON marshalling support.
417
+ #
418
+ def as_json: (*untyped) -> Hash[String, String]
419
+
420
+ # return the JSON value
421
+ #
422
+ def to_json: (?JSON::State state) -> String
423
+ end
424
+
425
+ class Complex
426
+ # Deserializes JSON string by converting Real value `r`, imaginary value `i`, to
427
+ # a Complex object.
428
+ #
429
+ def self.json_create: (Hash[String, String | Numeric] object) -> instance
430
+
431
+ # Returns a hash, that will be turned into a JSON object and represent this
432
+ # object.
433
+ #
434
+ def as_json: (*untyped) -> Hash[String, String | Numeric]
435
+
436
+ # Stores class name (Complex) along with real value `r` and imaginary value `i`
437
+ # as JSON string
438
+ #
439
+ def to_json: (?JSON::State state) -> String
440
+ end
441
+
442
+ class Date
443
+ # Deserializes JSON string by converting Julian year `y`, month `m`, day `d` and
444
+ # Day of Calendar Reform `sg` to Date.
445
+ #
446
+ def self.json_create: (Hash[String, String | Integer | Float] object) -> instance
447
+
448
+ # Returns a hash, that will be turned into a JSON object and represent this
449
+ # object.
450
+ #
451
+ def as_json: (*untyped) -> Hash[String, String | Integer | Float]
452
+
453
+ # Stores class name (Date) with Julian year `y`, month `m`, day `d` and Day of
454
+ # Calendar Reform `sg` as JSON string
455
+ #
456
+ def to_json: (?JSON::State state) -> String
457
+ end
458
+
459
+ class DateTime
460
+ # Deserializes JSON string by converting year `y`, month `m`, day `d`, hour `H`,
461
+ # minute `M`, second `S`, offset `of` and Day of Calendar Reform `sg` to
462
+ # DateTime.
463
+ #
464
+ def self.json_create: (Hash[String, String | Integer | Float] object) -> instance
465
+
466
+ # Returns a hash, that will be turned into a JSON object and represent this
467
+ # object.
468
+ #
469
+ def as_json: (*untyped) -> Hash[String, String | Integer | Float]
470
+
471
+ # Stores class name (DateTime) with Julian year `y`, month `m`, day `d`, hour
472
+ # `H`, minute `M`, second `S`, offset `of` and Day of Calendar Reform `sg` as
473
+ # JSON string
474
+ #
475
+ def to_json: (?JSON::State state) -> String
476
+ end
477
+
478
+ class Exception
479
+ # Deserializes JSON string by constructing new Exception object with message `m`
480
+ # and backtrace `b` serialized with `to_json`
481
+ #
482
+ def self.json_create: (Hash[String, String | Array[String] | nil] object) -> instance
483
+
484
+ # Returns a hash, that will be turned into a JSON object and represent this
485
+ # object.
486
+ #
487
+ def as_json: (*untyped) -> Hash[String, String | Array[String] | nil]
488
+
489
+ # Stores class name (Exception) with message `m` and backtrace array `b` as JSON
490
+ # string
491
+ #
492
+ def to_json: (?JSON::State state) -> String
493
+ end
494
+
495
+ class OpenStruct
496
+ # Deserializes JSON string by constructing new Struct object with values `t`
497
+ # serialized by `to_json`.
498
+ #
499
+ def self.json_create: (Hash[String, String | Hash[Symbol, untyped]] object) -> instance
500
+
501
+ # Returns a hash, that will be turned into a JSON object and represent this
502
+ # object.
503
+ #
504
+ def as_json: (*untyped) -> Hash[String, String | Hash[Symbol, untyped]]
505
+
506
+ # Stores class name (OpenStruct) with this struct's values `t` as a JSON string.
507
+ #
508
+ def to_json: (?JSON::State state) -> String
509
+ end
510
+
511
+ class Range[out Elem]
512
+ # Deserializes JSON string by constructing new Range object with arguments `a`
513
+ # serialized by `to_json`.
514
+ #
515
+ def self.json_create: (Hash[String, String | [Elem, Elem, bool]] object) -> instance
516
+
517
+ # Returns a hash, that will be turned into a JSON object and represent this
518
+ # object.
519
+ #
520
+ def as_json: (*untyped) -> Hash[String, String | [Elem, Elem, bool]]
521
+
522
+ # Stores class name (Range) with JSON array of arguments `a` which include
523
+ # `first` (integer), `last` (integer), and `exclude_end?` (boolean) as JSON
524
+ # string.
525
+ #
526
+ def to_json: (?JSON::State state) -> String
527
+ end
528
+
529
+ class Rational
530
+ # Deserializes JSON string by converting numerator value `n`, denominator value
531
+ # `d`, to a Rational object.
532
+ #
533
+ def self.json_create: (Hash[String, String | Integer] object) -> instance
534
+
535
+ # Returns a hash, that will be turned into a JSON object and represent this
536
+ # object.
537
+ #
538
+ def as_json: (*untyped) -> Hash[String, String | Integer]
539
+
540
+ # Stores class name (Rational) along with numerator value `n` and denominator
541
+ # value `d` as JSON string
542
+ #
543
+ def to_json: (?JSON::State state) -> String
544
+ end
545
+
546
+ class Regexp
547
+ # Deserializes JSON string by constructing new Regexp object with source `s`
548
+ # (Regexp or String) and options `o` serialized by `to_json`
549
+ #
550
+ def self.json_create: (Hash[String, String | Integer] object) -> instance
551
+
552
+ # Returns a hash, that will be turned into a JSON object and represent this
553
+ # object.
554
+ #
555
+ def as_json: (*untyped) -> Hash[String, String | Integer]
556
+
557
+ # Stores class name (Regexp) with options `o` and source `s` (Regexp or String)
558
+ # as JSON string
559
+ #
560
+ def to_json: (?JSON::State state) -> String
561
+ end
562
+
563
+ class Set[A]
564
+ # Import a JSON Marshalled object.
565
+ #
566
+ # method used for JSON marshalling support.
567
+ #
568
+ def self.json_create: (Hash[String, String | Array[A]] object) -> instance
569
+
570
+ # Marshal the object to JSON.
571
+ #
572
+ # method used for JSON marshalling support.
573
+ #
574
+ def as_json: (*untyped) -> Hash[String, String | Array[A]]
575
+
576
+ # return the JSON value
577
+ #
578
+ def to_json: (?JSON::State state) -> String
579
+ end
580
+
581
+ class Struct[Elem]
582
+ # Deserializes JSON string by constructing new Struct object with values `v`
583
+ # serialized by `to_json`.
584
+ #
585
+ def self.json_create: (Hash[String, String | Array[Elem]] object) -> instance
586
+
587
+ # Returns a hash, that will be turned into a JSON object and represent this
588
+ # object.
589
+ #
590
+ def as_json: (*untyped) -> Hash[String, String | Array[Elem]]
591
+
592
+ # Stores class name (Struct) with Struct values `v` as a JSON string. Only named
593
+ # structs are supported.
594
+ #
595
+ def to_json: (?JSON::State state) -> String
596
+ end
597
+
598
+ class Symbol
599
+ # Deserializes JSON string by converting the `string` value stored in the object
600
+ # to a Symbol
601
+ #
602
+ def self.json_create: (Hash[String, String] object) -> instance
603
+
604
+ # Returns a hash, that will be turned into a JSON object and represent this
605
+ # object.
606
+ #
607
+ def as_json: (*untyped) -> Hash[String, String]
608
+
609
+ # Stores class name (Symbol) with String representation of Symbol as a JSON
610
+ # string.
611
+ #
612
+ def to_json: (?JSON::State state) -> String
613
+ end
614
+
615
+ class Time
616
+ # Deserializes JSON string by converting time since epoch to Time
617
+ #
618
+ def self.json_create: (Hash[String, String | Integer] object) -> instance
619
+
620
+ # Returns a hash, that will be turned into a JSON object and represent this
621
+ # object.
622
+ #
623
+ def as_json: (*untyped) -> Hash[String, String | Integer]
624
+
625
+ # Stores class name (Time) with number of seconds since epoch and number of
626
+ # microseconds for Time as JSON string
627
+ #
628
+ def to_json: (?JSON::State state) -> String
629
+ end
@@ -240,7 +240,8 @@ class Pathname
240
240
  # relative to the right argument. Or it will return `nil` if the arguments are
241
241
  # not comparable.
242
242
  #
243
- def <=>: (untyped other) -> Integer?
243
+ def <=>: (Pathname other) -> Integer
244
+ | (untyped other) -> nil
244
245
 
245
246
  # Compare this pathname with `other`. The comparison is string-based. Be aware
246
247
  # that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
@@ -0,0 +1,3 @@
1
+ class Gem::BasicSpecification
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::ConfigFile
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,5 @@
1
+ class Gem::DependencyInstaller
2
+ type options = Hash[Symbol, untyped] # TODO: Add options...
3
+
4
+ # TODO: Add sinatures...
5
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::Installer
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::PathSupport
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::Platform
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,7 @@
1
+ class Gem::RequestSet
2
+ # TODO: Add sinatures...
3
+ end
4
+
5
+ class Gem::RequestSet::GemDependencyAPI
6
+ # TODO: Add sinatures...
7
+ end
@@ -0,0 +1,3 @@
1
+ class Gem::Requirement
2
+ # TODO: Add sinatures...
3
+ end
@@ -0,0 +1,710 @@
1
+ # RubyGems is the Ruby standard for publishing and managing third party
2
+ # libraries.
3
+ #
4
+ # For user documentation, see:
5
+ #
6
+ # * `gem help` and `gem help [command]`
7
+ # * [RubyGems User Guide](https://guides.rubygems.org/)
8
+ # * [Frequently Asked Questions](https://guides.rubygems.org/faqs)
9
+ #
10
+ #
11
+ # For gem developer documentation see:
12
+ #
13
+ # * [Creating Gems](https://guides.rubygems.org/make-your-own-gem)
14
+ # * Gem::Specification
15
+ # * Gem::Version for version dependency notes
16
+ #
17
+ #
18
+ # Further RubyGems documentation can be found at:
19
+ #
20
+ # * [RubyGems Guides](https://guides.rubygems.org)
21
+ # * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
22
+ # available from `gem server`)
23
+ #
24
+ #
25
+ # ## RubyGems Plugins
26
+ #
27
+ # RubyGems will load plugins in the latest version of each installed gem or
28
+ # $LOAD_PATH. Plugins must be named 'rubygems_plugin' (.rb, .so, etc) and
29
+ # placed at the root of your gem's #require_path. Plugins are installed at a
30
+ # special location and loaded on boot.
31
+ #
32
+ # For an example plugin, see the [Graph gem](https://github.com/seattlerb/graph)
33
+ # which adds a `gem graph` command.
34
+ #
35
+ # ## RubyGems Defaults, Packaging
36
+ #
37
+ # RubyGems defaults are stored in lib/rubygems/defaults.rb. If you're packaging
38
+ # RubyGems or implementing Ruby you can change RubyGems' defaults.
39
+ #
40
+ # For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb and
41
+ # override any defaults from lib/rubygems/defaults.rb.
42
+ #
43
+ # For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb and
44
+ # override any defaults from lib/rubygems/defaults.rb.
45
+ #
46
+ # If you need RubyGems to perform extra work on install or uninstall, your
47
+ # defaults override file can set pre/post install and uninstall hooks. See
48
+ # Gem::pre_install, Gem::pre_uninstall, Gem::post_install, Gem::post_uninstall.
49
+ #
50
+ # ## Bugs
51
+ #
52
+ # You can submit bugs to the [RubyGems bug
53
+ # tracker](https://github.com/rubygems/rubygems/issues) on GitHub
54
+ #
55
+ # ## Credits
56
+ #
57
+ # RubyGems is currently maintained by Eric Hodel.
58
+ #
59
+ # RubyGems was originally developed at RubyConf 2003 by:
60
+ #
61
+ # * Rich Kilmer -- rich(at)infoether.com
62
+ # * Chad Fowler -- chad(at)chadfowler.com
63
+ # * David Black -- dblack(at)wobblini.net
64
+ # * Paul Brannan -- paul(at)atdesk.com
65
+ # * Jim Weirich -- jim(at)weirichhouse.org
66
+ #
67
+ #
68
+ # Contributors:
69
+ #
70
+ # * Gavin Sinclair -- gsinclair(at)soyabean.com.au
71
+ # * George Marrows -- george.marrows(at)ntlworld.com
72
+ # * Dick Davies -- rasputnik(at)hellooperator.net
73
+ # * Mauricio Fernandez -- batsman.geo(at)yahoo.com
74
+ # * Simon Strandgaard -- neoneye(at)adslhome.dk
75
+ # * Dave Glasser -- glasser(at)mit.edu
76
+ # * Paul Duncan -- pabs(at)pablotron.org
77
+ # * Ville Aine -- vaine(at)cs.helsinki.fi
78
+ # * Eric Hodel -- drbrain(at)segment7.net
79
+ # * Daniel Berger -- djberg96(at)gmail.com
80
+ # * Phil Hagelberg -- technomancy(at)gmail.com
81
+ # * Ryan Davis -- ryand-ruby(at)zenspider.com
82
+ # * Evan Phoenix -- evan(at)fallingsnow.net
83
+ # * Steve Klabnik -- steve(at)steveklabnik.com
84
+ #
85
+ #
86
+ # (If your name is missing, PLEASE let us know!)
87
+ #
88
+ # ## License
89
+ #
90
+ # See [LICENSE.txt](rdoc-ref:lib/rubygems/LICENSE.txt) for permissions.
91
+ #
92
+ # Thanks!
93
+ #
94
+ # -The RubyGems Team
95
+ #
96
+ module Gem
97
+ interface _HashLike[K, V]
98
+ def each_pair: () { ([ K, V ]) -> untyped } -> self
99
+ end
100
+
101
+ DEFAULT_HOST: String
102
+
103
+ GEM_DEP_FILES: Array[String]
104
+
105
+ # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to
106
+ # override Kernel#warn
107
+ #
108
+ KERNEL_WARN_IGNORES_INTERNAL_ENTRIES: bool
109
+
110
+ LOADED_SPECS_MUTEX: Thread::Mutex
111
+
112
+ # Location of Marshal quick gemspecs on remote repositories
113
+ #
114
+ MARSHAL_SPEC_DIR: String
115
+
116
+ # Exception classes used in a Gem.read_binary `rescue` statement
117
+ #
118
+ READ_BINARY_ERRORS: Array[Class]
119
+
120
+ # Subdirectories in a gem repository for default gems
121
+ #
122
+ REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES: Array[String]
123
+
124
+ # Subdirectories in a gem repository
125
+ #
126
+ REPOSITORY_SUBDIRECTORIES: Array[String]
127
+
128
+ RUBYGEMS_DIR: String
129
+
130
+ # Taint support is deprecated in Ruby 2.7. This allows switching ".untaint" to
131
+ # ".tap(&Gem::UNTAINT)", to avoid deprecation warnings in Ruby 2.7.
132
+ #
133
+ UNTAINT: Proc
134
+
135
+ VERSION: String
136
+
137
+ # An Array of Regexps that match windows Ruby platforms.
138
+ #
139
+ WIN_PATTERNS: Array[Regexp]
140
+
141
+ # Exception classes used in Gem.write_binary `rescue` statement
142
+ #
143
+ WRITE_BINARY_ERRORS: Array[Class]
144
+
145
+ # The number of paths in the `$LOAD_PATH` from activated gems. Used to
146
+ # prioritize `-I` and `[ENV]('RUBYLIB`)` entries during `require`.
147
+ #
148
+ def self.activated_gem_paths: () -> Integer
149
+
150
+ # Add a list of paths to the $LOAD_PATH at the proper place.
151
+ #
152
+ def self.add_to_load_path: (*String paths) -> Array[String]
153
+
154
+ # Find the full path to the executable for gem `name`. If the `exec_name` is
155
+ # not given, an exception will be raised, otherwise the specified executable's
156
+ # path is returned. `requirements` allows you to specify specific gem versions.
157
+ #
158
+ def self.bin_path: (String name, String exec_name, ?Array[Requirement] requirements) -> String
159
+
160
+ # The mode needed to read a file as straight binary.
161
+ #
162
+ def self.binary_mode: () -> String
163
+
164
+ # The path where gem executables are to be installed.
165
+ #
166
+ def self.bindir: (?String install_dir) -> String
167
+
168
+ # The path to standard location of the user's cache directory.
169
+ #
170
+ def self.cache_home: () -> String
171
+
172
+ # Clear default gem related variables. It is for test
173
+ #
174
+ def self.clear_default_specs: () -> void
175
+
176
+ # Reset the `dir` and `path` values. The next time `dir` or `path` is
177
+ # requested, the values will be calculated from scratch. This is mainly used by
178
+ # the unit tests to provide test isolation.
179
+ #
180
+ def self.clear_paths: () -> void
181
+
182
+ # The path to standard location of the user's .gemrc file.
183
+ #
184
+ def self.config_file: () -> String
185
+
186
+ # The path to standard location of the user's configuration directory.
187
+ #
188
+ def self.config_home: () -> String
189
+
190
+ # The standard configuration object for gems.
191
+ #
192
+ def self.configuration: () -> ConfigFile
193
+
194
+ # Use the given configuration object (which implements the ConfigFile protocol)
195
+ # as the standard configuration object.
196
+ #
197
+ def self.configuration=: (ConfigFile config) -> ConfigFile
198
+
199
+ # The path to standard location of the user's data directory.
200
+ #
201
+ def self.data_home: () -> String
202
+
203
+ # The path to the data directory specified by the gem name. If the package is
204
+ # not available as a gem, return nil.
205
+ #
206
+ def self.datadir: (String gem_name) -> String?
207
+
208
+ # The default directory for binaries
209
+ #
210
+ def self.default_bindir: () -> String
211
+
212
+ # The default signing certificate chain path
213
+ #
214
+ def self.default_cert_path: () -> String
215
+
216
+ # Default home directory path to be used if an alternate value is not specified
217
+ # in the environment
218
+ #
219
+ def self.default_dir: () -> String
220
+
221
+ # Deduce Ruby's --program-prefix and --program-suffix from its install name
222
+ #
223
+ def self.default_exec_format: () -> String
224
+
225
+ # Returns binary extensions dir for specified RubyGems base dir or nil if such
226
+ # directory cannot be determined.
227
+ #
228
+ # By default, the binary extensions are located side by side with their Ruby
229
+ # counterparts, therefore nil is returned
230
+ #
231
+ def self.default_ext_dir_for: (String base_dir) -> String?
232
+
233
+ # The default signing key path
234
+ #
235
+ def self.default_key_path: () -> String
236
+
237
+ # Default gem load path
238
+ #
239
+ def self.default_path: () -> Array[String]
240
+
241
+ # Paths where RubyGems' .rb files and bin files are installed
242
+ #
243
+ def self.default_rubygems_dirs: () -> Array[String]?
244
+
245
+ # An Array of the default sources that come with RubyGems
246
+ #
247
+ def self.default_sources: () -> Array[String]
248
+
249
+ # Default spec directory path to be used if an alternate value is not specified
250
+ # in the environment
251
+ #
252
+ def self.default_spec_cache_dir: () -> String
253
+
254
+ # Path to specification files of default gems.
255
+ #
256
+ def self.default_specifications_dir: () -> String
257
+
258
+ # A Zlib::Deflate.deflate wrapper
259
+ #
260
+ def self.deflate: (String data) -> String
261
+
262
+ # The path where gems are to be installed.
263
+ #
264
+ def self.dir: () -> String
265
+
266
+ # RubyGems distributors (like operating system package managers) can disable
267
+ # RubyGems update by setting this to error message printed to end-users on gem
268
+ # update --system instead of actual update.
269
+ #
270
+ def self.disable_system_update_message: () -> String?
271
+
272
+ def self.disable_system_update_message=: (String?) -> String?
273
+
274
+ # Adds a post-installs hook that will be passed a Gem::DependencyInstaller and a
275
+ # list of installed specifications when Gem::DependencyInstaller#install is
276
+ # complete
277
+ #
278
+ def self.done_installing: () { (DependencyInstaller, Array[Specification]) -> untyped } -> Array[Proc]
279
+
280
+ # The list of hooks to be run after Gem::DependencyInstaller installs a set of
281
+ # gems
282
+ #
283
+ def self.done_installing_hooks: () -> Array[Proc?]
284
+
285
+ # Quietly ensure the Gem directory `dir` contains all the proper subdirectories
286
+ # for handling default gems. If we can't create a directory due to a permission
287
+ # problem, then we will silently continue.
288
+ #
289
+ # If `mode` is given, missing directories are created with this mode.
290
+ #
291
+ # World-writable directories will never be created.
292
+ #
293
+ def self.ensure_default_gem_subdirectories: (?String dir, ?Integer | String mode) -> Array[String]
294
+
295
+ # Quietly ensure the Gem directory `dir` contains all the proper subdirectories.
296
+ # If we can't create a directory due to a permission problem, then we will
297
+ # silently continue.
298
+ #
299
+ # If `mode` is given, missing directories are created with this mode.
300
+ #
301
+ # World-writable directories will never be created.
302
+ #
303
+ def self.ensure_gem_subdirectories: (?String dir, ?Integer | String mode) -> Array[String]
304
+
305
+ def self.env_requirement: (String gem_name) -> Requirement
306
+
307
+ # Finds the user's config file
308
+ #
309
+ def self.find_config_file: () -> String
310
+
311
+ # Returns a list of paths matching `glob` that can be used by a gem to pick up
312
+ # features from other gems. For example:
313
+ #
314
+ # Gem.find_files('rdoc/discover').each do |path| load path end
315
+ #
316
+ # if `check_load_path` is true (the default), then find_files also searches
317
+ # $LOAD_PATH for files as well as gems.
318
+ #
319
+ # Note that find_files will return all files even if they are from different
320
+ # versions of the same gem. See also find_latest_files
321
+ #
322
+ def self.find_files: (String glob, ?boolish check_load_path) -> Array[String]
323
+
324
+ # Returns a list of paths matching `glob` from the latest gems that can be used
325
+ # by a gem to pick up features from other gems. For example:
326
+ #
327
+ # Gem.find_latest_files('rdoc/discover').each do |path| load path end
328
+ #
329
+ # if `check_load_path` is true (the default), then find_latest_files also
330
+ # searches $LOAD_PATH for files as well as gems.
331
+ #
332
+ # Unlike find_files, find_latest_files will return only files from the latest
333
+ # version of a gem.
334
+ #
335
+ def self.find_latest_files: (String glob, ?boolish check_load_path) -> Array[String]
336
+
337
+ # Find a Gem::Specification of default gem from `path`
338
+ #
339
+ def self.find_unresolved_default_spec: (String path) -> Specification?
340
+
341
+ def self.finish_resolve: (?RequestSet request_set) -> void
342
+
343
+ # GemDependencyAPI object, which is set when .use_gemdeps is called. This
344
+ # contains all the information from the Gemfile.
345
+ #
346
+ def self.gemdeps: () -> RequestSet::GemDependencyAPI?
347
+
348
+ # Get the default RubyGems API host. This is normally `https://rubygems.org`.
349
+ #
350
+ def self.host: () -> String
351
+
352
+ # Set the default RubyGems API host.
353
+ #
354
+ def self.host=: (String host) -> String
355
+
356
+ # Top level install helper method. Allows you to install gems interactively:
357
+ #
358
+ # % irb
359
+ # >> Gem.install "minitest"
360
+ # Fetching: minitest-5.14.0.gem (100%)
361
+ # => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
362
+ #
363
+ def self.install: (String name, ?Gem::Requirement version, *DependencyInstaller::options options) -> Array[Specification]
364
+
365
+ # Is this a java platform?
366
+ #
367
+ def self.java_platform?: () -> bool
368
+
369
+ # Returns the latest release version of RubyGems.
370
+ #
371
+ def self.latest_rubygems_version: () -> Version
372
+
373
+ # Returns the latest release-version specification for the gem `name`.
374
+ #
375
+ def self.latest_spec_for: (String name) -> Specification?
376
+
377
+ # Returns the version of the latest release-version of gem `name`
378
+ #
379
+ def self.latest_version_for: (String name) -> Version?
380
+
381
+ # Find all 'rubygems_plugin' files in $LOAD_PATH and load them
382
+ #
383
+ def self.load_env_plugins: () -> Array[String]
384
+
385
+ # The index to insert activated gem paths into the $LOAD_PATH. The activated
386
+ # gem's paths are inserted before site lib directory by default.
387
+ #
388
+ def self.load_path_insert_index: () -> Integer
389
+
390
+ # Find rubygems plugin files in the standard location and load them
391
+ #
392
+ def self.load_plugins: () -> Array[String]
393
+
394
+ # Loads YAML, preferring Psych
395
+ #
396
+ def self.load_yaml: () -> bool?
397
+
398
+ # Hash of loaded Gem::Specification keyed by name
399
+ #
400
+ def self.loaded_specs: () -> Hash[String, BasicSpecification]
401
+
402
+ # The file name and line number of the caller of the caller of this method.
403
+ #
404
+ # `depth` is how many layers up the call stack it should go.
405
+ #
406
+ # e.g.,
407
+ #
408
+ # def a; Gem.location_of_caller; end a #=> ["x.rb", 2] # (it'll vary depending
409
+ # on file name and line number)
410
+ #
411
+ # def b; c; end def c; Gem.location_of_caller(2); end b #=> ["x.rb", 6] #
412
+ # (it'll vary depending on file name and line number)
413
+ #
414
+ def self.location_of_caller: (?Integer depth) -> [ String, Integer ]
415
+
416
+ # The version of the Marshal format for your Ruby.
417
+ #
418
+ def self.marshal_version: () -> String
419
+
420
+ def self.needs: () { (RequestSet) -> void } -> void
421
+
422
+ # Default options for gem commands for Ruby packagers.
423
+ #
424
+ # The options here should be structured as an array of string "gem" command
425
+ # names as keys and a string of the default options as values.
426
+ #
427
+ # Example:
428
+ #
429
+ # def self.operating_system_defaults
430
+ # {
431
+ # 'install' => '--no-rdoc --no-ri --env-shebang',
432
+ # 'update' => '--no-rdoc --no-ri --env-shebang'
433
+ # }
434
+ #
435
+ # end
436
+ #
437
+ def self.operating_system_defaults: () -> Hash[String, String]
438
+
439
+ def self.path: () -> Array[String]
440
+
441
+ # How String Gem paths should be split. Overridable for esoteric platforms.
442
+ #
443
+ def self.path_separator: () -> String
444
+
445
+ # Retrieve the PathSupport object that RubyGems uses to lookup files.
446
+ #
447
+ def self.paths: () -> PathSupport
448
+
449
+ # Initialize the filesystem paths to use from `env`. `env` is a hash-like object
450
+ # (typically ENV) that is queried for 'GEM_HOME', 'GEM_PATH', and
451
+ # 'GEM_SPEC_CACHE' Keys for the `env` hash should be Strings, and values of the
452
+ # hash should be Strings or `nil`.
453
+ #
454
+ def self.paths=: (_HashLike[String, String?] env) -> Array[String]
455
+
456
+ # Default options for gem commands for Ruby implementers.
457
+ #
458
+ # The options here should be structured as an array of string "gem" command
459
+ # names as keys and a string of the default options as values.
460
+ #
461
+ # Example:
462
+ #
463
+ # def self.platform_defaults
464
+ # {
465
+ # 'install' => '--no-rdoc --no-ri --env-shebang',
466
+ # 'update' => '--no-rdoc --no-ri --env-shebang'
467
+ # }
468
+ #
469
+ # end
470
+ #
471
+ def self.platform_defaults: () -> Hash[String, String]
472
+
473
+ # Array of platforms this RubyGems supports.
474
+ #
475
+ def self.platforms: () -> Array[String | Platform]
476
+
477
+ # Set array of platforms this RubyGems supports (primarily for testing).
478
+ #
479
+ def self.platforms=: (Array[String | Platform] platforms) -> Array[String | Platform]
480
+
481
+ # Glob pattern for require-able plugin suffixes.
482
+ #
483
+ def self.plugin_suffix_pattern: () -> String
484
+
485
+ # Regexp for require-able plugin suffixes.
486
+ #
487
+ def self.plugin_suffix_regexp: () -> Regexp
488
+
489
+ # The path were rubygems plugins are to be installed.
490
+ #
491
+ def self.plugindir: (?String install_dir) -> String
492
+
493
+ # Adds a post-build hook that will be passed an Gem::Installer instance when
494
+ # Gem::Installer#install is called. The hook is called after the gem has been
495
+ # extracted and extensions have been built but before the executables or gemspec
496
+ # has been written. If the hook returns `false` then the gem's files will be
497
+ # removed and the install will be aborted.
498
+ #
499
+ def self.post_build: () { (Installer) -> untyped } -> Array[Proc]
500
+
501
+ # The list of hooks to be run after Gem::Installer#install extracts files and
502
+ # builds extensions
503
+ #
504
+ def self.post_build_hooks: () -> Array[Proc]
505
+
506
+ # Adds a post-install hook that will be passed an Gem::Installer instance when
507
+ # Gem::Installer#install is called
508
+ #
509
+ def self.post_install: () { (Installer) -> untyped } -> Array[Proc]
510
+
511
+ # The list of hooks to be run after Gem::Installer#install completes
512
+ # installation
513
+ #
514
+ def self.post_install_hooks: () -> Array[Proc]
515
+
516
+ # Adds a hook that will get run after Gem::Specification.reset is run.
517
+ #
518
+ def self.post_reset: () { () -> untyped } -> Array[Proc]
519
+
520
+ # The list of hooks to be run after Gem::Specification.reset is run.
521
+ #
522
+ def self.post_reset_hooks: () -> Array[Proc?]
523
+
524
+ # Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance and
525
+ # the spec that was uninstalled when Gem::Uninstaller#uninstall is called
526
+ #
527
+ def self.post_uninstall: () { (Uninstaller) -> untyped } -> Array[Proc]
528
+
529
+ # The list of hooks to be run after Gem::Uninstaller#uninstall completes
530
+ # installation
531
+ #
532
+ def self.post_uninstall_hooks: () -> Array[Proc?]
533
+
534
+ # Adds a pre-install hook that will be passed an Gem::Installer instance when
535
+ # Gem::Installer#install is called. If the hook returns `false` then the
536
+ # install will be aborted.
537
+ #
538
+ def self.pre_install: () { (Installer) -> untyped } -> Array[Proc]
539
+
540
+ # The list of hooks to be run before Gem::Installer#install does any work
541
+ #
542
+ def self.pre_install_hooks: () -> Array[Proc?]
543
+
544
+ # Adds a hook that will get run before Gem::Specification.reset is run.
545
+ #
546
+ def self.pre_reset: () { () -> untyped } -> Array[Proc]
547
+
548
+ # The list of hooks to be run before Gem::Specification.reset is run.
549
+ #
550
+ def self.pre_reset_hooks: () -> Array[Proc?]
551
+
552
+ # Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance and
553
+ # the spec that will be uninstalled when Gem::Uninstaller#uninstall is called
554
+ #
555
+ def self.pre_uninstall: () { (Uninstaller) -> untyped } -> Array[Proc]
556
+
557
+ # The list of hooks to be run before Gem::Uninstaller#uninstall does any work
558
+ #
559
+ def self.pre_uninstall_hooks: () -> Array[Proc?]
560
+
561
+ # The directory prefix this RubyGems was installed at. If your prefix is in a
562
+ # standard location (ie, rubygems is installed where you'd expect it to be),
563
+ # then prefix returns nil.
564
+ #
565
+ def self.prefix: () -> String?
566
+
567
+ # Safely read a file in binary mode on all platforms.
568
+ #
569
+ def self.read_binary: (String path) -> String
570
+
571
+ # Refresh available gems from disk.
572
+ #
573
+ def self.refresh: () -> Array[Proc]
574
+
575
+ # Register a Gem::Specification for default gem.
576
+ #
577
+ # Two formats for the specification are supported:
578
+ #
579
+ # * MRI 2.0 style, where spec.files contains unprefixed require names. The
580
+ # spec's filenames will be registered as-is.
581
+ # * New style, where spec.files contains files prefixed with paths from
582
+ # spec.require_paths. The prefixes are stripped before registering the
583
+ # spec's filenames. Unprefixed files are omitted.
584
+ #
585
+ def self.register_default_spec: (Specification spec) -> Array[String]
586
+
587
+ # The path to the running Ruby interpreter.
588
+ #
589
+ def self.ruby: () -> String
590
+
591
+ # Returns a String containing the API compatibility version of Ruby
592
+ #
593
+ def self.ruby_api_version: () -> String
594
+
595
+ def self.ruby_engine: () -> String
596
+
597
+ # A Gem::Version for the currently running Ruby.
598
+ #
599
+ def self.ruby_version: () -> Version
600
+
601
+ # A Gem::Version for the currently running RubyGems
602
+ #
603
+ def self.rubygems_version: () -> Version
604
+
605
+ # Returns the value of Gem.source_date_epoch_string, as a Time object.
606
+ #
607
+ # This is used throughout RubyGems for enabling reproducible builds.
608
+ #
609
+ def self.source_date_epoch: () -> Time
610
+
611
+ # If the SOURCE_DATE_EPOCH environment variable is set, returns it's value.
612
+ # Otherwise, returns the time that `Gem.source_date_epoch_string` was first
613
+ # called in the same format as SOURCE_DATE_EPOCH.
614
+ #
615
+ # NOTE(@duckinator): The implementation is a tad weird because we want to:
616
+ # 1. Make builds reproducible by default, by having this function always
617
+ # return the same result during a given run.
618
+ # 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple
619
+ # tests that set this variable will be run in a single process.
620
+ #
621
+ # If you simplify this function and a lot of tests fail, that is likely due to
622
+ # #2 above.
623
+ #
624
+ # Details on SOURCE_DATE_EPOCH:
625
+ # https://reproducible-builds.org/specs/source-date-epoch/
626
+ #
627
+ def self.source_date_epoch_string: () -> String
628
+
629
+ # Returns an Array of sources to fetch remote gems from. Uses default_sources if
630
+ # the sources list is empty.
631
+ #
632
+ def self.sources: () -> SourceList
633
+
634
+ # Need to be able to set the sources without calling Gem.sources.replace since
635
+ # that would cause an infinite loop.
636
+ #
637
+ # DOC: This comment is not documentation about the method itself, it's more of a
638
+ # code comment about the implementation.
639
+ #
640
+ def self.sources=: (SourceList? new_sources) -> SourceList?
641
+
642
+ def self.spec_cache_dir: () -> String
643
+
644
+ # Glob pattern for require-able path suffixes.
645
+ #
646
+ def self.suffix_pattern: () -> String
647
+
648
+ # Regexp for require-able path suffixes.
649
+ #
650
+ def self.suffix_regexp: () -> Regexp
651
+
652
+ # Suffixes for require-able paths.
653
+ #
654
+ def self.suffixes: () -> Array[String]
655
+
656
+ # Prints the amount of time the supplied block takes to run using the debug UI
657
+ # output.
658
+ #
659
+ def self.time: [T] (String msg, ?Integer width, ?boolish display) { () -> T } -> T
660
+
661
+ # Try to activate a gem containing `path`. Returns true if activation succeeded
662
+ # or wasn't needed because it was already activated. Returns false if it can't
663
+ # find the path in a gem.
664
+ #
665
+ def self.try_activate: (String path) -> bool
666
+
667
+ # Lazily loads DefaultUserInteraction and returns the default UI.
668
+ #
669
+ def self.ui: () -> StreamUI
670
+
671
+ # Looks for a gem dependency file at `path` and activates the gems in the file
672
+ # if found. If the file is not found an ArgumentError is raised.
673
+ #
674
+ # If `path` is not given the RUBYGEMS_GEMDEPS environment variable is used, but
675
+ # if no file is found no exception is raised.
676
+ #
677
+ # If '-' is given for `path` RubyGems searches up from the current working
678
+ # directory for gem dependency files (gem.deps.rb, Gemfile, Isolate) and
679
+ # activates the gems in the first one found.
680
+ #
681
+ # You can run this automatically when rubygems starts. To enable, set the
682
+ # `RUBYGEMS_GEMDEPS` environment variable to either the path of your gem
683
+ # dependencies file or "-" to auto-discover in parent directories.
684
+ #
685
+ # NOTE: Enabling automatic discovery on multiuser systems can lead to execution
686
+ # of arbitrary code when used from directories outside your control.
687
+ #
688
+ def self.use_gemdeps: (?String path) -> Array[Specification]?
689
+
690
+ # Use the `home` and `paths` values for Gem.dir and Gem.path. Used mainly by
691
+ # the unit tests to provide environment isolation.
692
+ #
693
+ def self.use_paths: (String home, *String paths) -> Hash[String, String]
694
+
695
+ # Path for gems in the user's home directory
696
+ #
697
+ def self.user_dir: () -> String
698
+
699
+ # The home directory for the user.
700
+ #
701
+ def self.user_home: () -> String
702
+
703
+ # Is this a windows platform?
704
+ #
705
+ def self.win_platform?: () -> bool
706
+
707
+ # Safely write a file in binary mode on all platforms.
708
+ #
709
+ def self.write_binary: (String path, String data) -> Integer
710
+ end