ruby-paseto 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +8 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +549 -0
- data/lib/paseto/asn1/algorithm_identifier.rb +17 -0
- data/lib/paseto/asn1/curve_private_key.rb +22 -0
- data/lib/paseto/asn1/ec_private_key.rb +27 -0
- data/lib/paseto/asn1/ecdsa_full_r.rb +26 -0
- data/lib/paseto/asn1/ecdsa_sig_value.rb +23 -0
- data/lib/paseto/asn1/ecdsa_signature.rb +49 -0
- data/lib/paseto/asn1/ed25519_identifier.rb +15 -0
- data/lib/paseto/asn1/named_curve.rb +17 -0
- data/lib/paseto/asn1/one_asymmetric_key.rb +32 -0
- data/lib/paseto/asn1/private_key.rb +17 -0
- data/lib/paseto/asn1/private_key_algorithm_identifier.rb +17 -0
- data/lib/paseto/asn1/public_key.rb +17 -0
- data/lib/paseto/asn1/subject_public_key_info.rb +28 -0
- data/lib/paseto/asn1.rb +101 -0
- data/lib/paseto/asymmetric_key.rb +100 -0
- data/lib/paseto/configuration/box.rb +23 -0
- data/lib/paseto/configuration/decode_configuration.rb +68 -0
- data/lib/paseto/configuration.rb +18 -0
- data/lib/paseto/interface/i_d.rb +23 -0
- data/lib/paseto/interface/key.rb +113 -0
- data/lib/paseto/interface/pbkd.rb +83 -0
- data/lib/paseto/interface/pie.rb +59 -0
- data/lib/paseto/interface/pke.rb +86 -0
- data/lib/paseto/interface/serializer.rb +19 -0
- data/lib/paseto/interface/version.rb +161 -0
- data/lib/paseto/interface/wrapper.rb +20 -0
- data/lib/paseto/operations/i_d.rb +48 -0
- data/lib/paseto/operations/id/i_dv3.rb +20 -0
- data/lib/paseto/operations/id/i_dv4.rb +20 -0
- data/lib/paseto/operations/pbkd/p_b_k_dv3.rb +85 -0
- data/lib/paseto/operations/pbkd/p_b_k_dv4.rb +94 -0
- data/lib/paseto/operations/pbkw.rb +73 -0
- data/lib/paseto/operations/pke/p_k_ev3.rb +97 -0
- data/lib/paseto/operations/pke/p_k_ev4.rb +95 -0
- data/lib/paseto/operations/pke.rb +57 -0
- data/lib/paseto/operations/wrap.rb +29 -0
- data/lib/paseto/paserk.rb +55 -0
- data/lib/paseto/paserk_types.rb +46 -0
- data/lib/paseto/protocol/version3.rb +100 -0
- data/lib/paseto/protocol/version4.rb +99 -0
- data/lib/paseto/result.rb +9 -0
- data/lib/paseto/serializer/optional_json.rb +30 -0
- data/lib/paseto/serializer/raw.rb +23 -0
- data/lib/paseto/sodium/curve_25519.rb +46 -0
- data/lib/paseto/sodium/safe_ed25519_loader.rb +19 -0
- data/lib/paseto/sodium/stream/base.rb +82 -0
- data/lib/paseto/sodium/stream/x_cha_cha20_xor.rb +31 -0
- data/lib/paseto/sodium.rb +5 -0
- data/lib/paseto/symmetric_key.rb +119 -0
- data/lib/paseto/token.rb +127 -0
- data/lib/paseto/token_types.rb +29 -0
- data/lib/paseto/util.rb +105 -0
- data/lib/paseto/v3/local.rb +63 -0
- data/lib/paseto/v3/public.rb +204 -0
- data/lib/paseto/v4/local.rb +56 -0
- data/lib/paseto/v4/public.rb +169 -0
- data/lib/paseto/validator.rb +154 -0
- data/lib/paseto/verifiers/footer.rb +30 -0
- data/lib/paseto/verifiers/payload.rb +42 -0
- data/lib/paseto/verify.rb +48 -0
- data/lib/paseto/version.rb +6 -0
- data/lib/paseto/versions.rb +25 -0
- data/lib/paseto/wrappers/pie/pie_v3.rb +72 -0
- data/lib/paseto/wrappers/pie/pie_v4.rb +72 -0
- data/lib/paseto/wrappers/pie.rb +71 -0
- data/lib/paseto.rb +99 -0
- data/paseto.gemspec +58 -0
- data/sorbet/config +3 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
- data/sorbet/rbi/gems/docile@1.4.0.rbi +376 -0
- data/sorbet/rbi/gems/ffi@1.15.5.rbi +1994 -0
- data/sorbet/rbi/gems/io-console@0.5.11.rbi +8 -0
- data/sorbet/rbi/gems/irb@1.5.1.rbi +342 -0
- data/sorbet/rbi/gems/json@2.6.3.rbi +1541 -0
- data/sorbet/rbi/gems/multi_json@1.15.0.rbi +267 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/sorbet/rbi/gems/oj@3.13.23.rbi +603 -0
- data/sorbet/rbi/gems/openssl@3.0.1.rbi +1735 -0
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +407 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +3021 -0
- data/sorbet/rbi/gems/rbnacl@7.1.1.rbi +3218 -0
- data/sorbet/rbi/gems/regexp_parser@2.6.1.rbi +3481 -0
- data/sorbet/rbi/gems/reline@0.3.1.rbi +8 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +4717 -0
- data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10887 -0
- data/sorbet/rbi/gems/rspec-expectations@3.12.0.rbi +8090 -0
- data/sorbet/rbi/gems/rspec-mocks@3.12.0.rbi +5300 -0
- data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1617 -0
- data/sorbet/rbi/gems/rspec@3.12.0.rbi +88 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1239 -0
- data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +219 -0
- data/sorbet/rbi/gems/simplecov@0.21.2.rbi +2135 -0
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +8 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
- data/sorbet/rbi/gems/timecop@0.9.6.rbi +350 -0
- data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +48 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +2555 -0
- data/sorbet/rbi/gems/yard-sorbet@0.7.0.rbi +391 -0
- data/sorbet/rbi/gems/yard@0.9.28.rbi +17816 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.6.rbi +950 -0
- data/sorbet/rbi/shims/multi_json.rbi +19 -0
- data/sorbet/rbi/shims/openssl.rbi +111 -0
- data/sorbet/rbi/shims/rbnacl.rbi +65 -0
- data/sorbet/rbi/shims/zeitwerk.rbi +6 -0
- data/sorbet/rbi/todo.rbi +7 -0
- data/sorbet/tapioca/config.yml +30 -0
- data/sorbet/tapioca/require.rb +12 -0
- metadata +376 -0
@@ -0,0 +1,950 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `zeitwerk` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem zeitwerk`.
|
6
|
+
|
7
|
+
# source://zeitwerk//lib/zeitwerk/kernel.rb#3
|
8
|
+
module Kernel
|
9
|
+
private
|
10
|
+
|
11
|
+
# source://zeitwerk//lib/zeitwerk/kernel.rb#27
|
12
|
+
def require(path); end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
# source://zeitwerk//lib/zeitwerk/kernel.rb#27
|
16
|
+
def require(path); end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# source://zeitwerk//lib/zeitwerk.rb#3
|
21
|
+
module Zeitwerk
|
22
|
+
class << self
|
23
|
+
# This is a dangerous method.
|
24
|
+
#
|
25
|
+
# source://zeitwerk//lib/zeitwerk.rb#20
|
26
|
+
def with_loader; end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# source://zeitwerk//lib/zeitwerk/error.rb#4
|
31
|
+
class Zeitwerk::Error < ::StandardError; end
|
32
|
+
|
33
|
+
# Centralizes the logic for the trace point used to detect the creation of
|
34
|
+
# explicit namespaces, needed to descend into matching subdirectories right
|
35
|
+
# after the constant has been defined.
|
36
|
+
#
|
37
|
+
# The implementation assumes an explicit namespace is managed by one loader.
|
38
|
+
# Loaders that reopen namespaces owned by other projects are responsible for
|
39
|
+
# loading their constant before setup. This is documented.
|
40
|
+
#
|
41
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#11
|
42
|
+
module Zeitwerk::ExplicitNamespace
|
43
|
+
extend ::Zeitwerk::RealModName
|
44
|
+
|
45
|
+
class << self
|
46
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35
|
47
|
+
def __register(cpath, loader); end
|
48
|
+
|
49
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45
|
50
|
+
def __unregister_loader(loader); end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
# Maps constant paths that correspond to explicit namespaces according to
|
55
|
+
# the file system, to the loader responsible for them.
|
56
|
+
#
|
57
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#20
|
58
|
+
def cpaths; end
|
59
|
+
|
60
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#51
|
61
|
+
def disable_tracer_if_unneeded; end
|
62
|
+
|
63
|
+
# Returns the value of attribute mutex.
|
64
|
+
#
|
65
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#24
|
66
|
+
def mutex; end
|
67
|
+
|
68
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35
|
69
|
+
def register(cpath, loader); end
|
70
|
+
|
71
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#58
|
72
|
+
def tracepoint_class_callback(event); end
|
73
|
+
|
74
|
+
# Returns the value of attribute tracer.
|
75
|
+
#
|
76
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#28
|
77
|
+
def tracer; end
|
78
|
+
|
79
|
+
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45
|
80
|
+
def unregister_loader(loader); end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# source://zeitwerk//lib/zeitwerk/gem_inflector.rb#5
|
85
|
+
class Zeitwerk::GemInflector < ::Zeitwerk::Inflector
|
86
|
+
# @return [GemInflector] a new instance of GemInflector
|
87
|
+
#
|
88
|
+
# source://zeitwerk//lib/zeitwerk/gem_inflector.rb#6
|
89
|
+
def initialize(root_file); end
|
90
|
+
|
91
|
+
# source://zeitwerk//lib/zeitwerk/gem_inflector.rb#13
|
92
|
+
def camelize(basename, abspath); end
|
93
|
+
end
|
94
|
+
|
95
|
+
# @private
|
96
|
+
#
|
97
|
+
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#7
|
98
|
+
class Zeitwerk::GemLoader < ::Zeitwerk::Loader
|
99
|
+
# @return [GemLoader] a new instance of GemLoader
|
100
|
+
#
|
101
|
+
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#17
|
102
|
+
def initialize(root_file, warn_on_extra_files:); end
|
103
|
+
|
104
|
+
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#30
|
105
|
+
def setup; end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#38
|
110
|
+
def warn_on_extra_files; end
|
111
|
+
|
112
|
+
class << self
|
113
|
+
# @private
|
114
|
+
#
|
115
|
+
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#12
|
116
|
+
def _new(root_file, warn_on_extra_files:); end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def new(*_arg0); end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# source://zeitwerk//lib/zeitwerk/inflector.rb#4
|
125
|
+
class Zeitwerk::Inflector
|
126
|
+
# Very basic snake case -> camel case conversion.
|
127
|
+
#
|
128
|
+
# inflector = Zeitwerk::Inflector.new
|
129
|
+
# inflector.camelize("post", ...) # => "Post"
|
130
|
+
# inflector.camelize("users_controller", ...) # => "UsersController"
|
131
|
+
# inflector.camelize("api", ...) # => "Api"
|
132
|
+
#
|
133
|
+
# Takes into account hard-coded mappings configured with `inflect`.
|
134
|
+
#
|
135
|
+
# source://zeitwerk//lib/zeitwerk/inflector.rb#15
|
136
|
+
def camelize(basename, _abspath); end
|
137
|
+
|
138
|
+
# Configures hard-coded inflections:
|
139
|
+
#
|
140
|
+
# inflector = Zeitwerk::Inflector.new
|
141
|
+
# inflector.inflect(
|
142
|
+
# "html_parser" => "HTMLParser",
|
143
|
+
# "mysql_adapter" => "MySQLAdapter"
|
144
|
+
# )
|
145
|
+
#
|
146
|
+
# inflector.camelize("html_parser", abspath) # => "HTMLParser"
|
147
|
+
# inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter"
|
148
|
+
# inflector.camelize("users_controller", abspath) # => "UsersController"
|
149
|
+
#
|
150
|
+
# source://zeitwerk//lib/zeitwerk/inflector.rb#32
|
151
|
+
def inflect(inflections); end
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
# Hard-coded basename to constant name user maps that override the default
|
156
|
+
# inflection logic.
|
157
|
+
#
|
158
|
+
# source://zeitwerk//lib/zeitwerk/inflector.rb#42
|
159
|
+
def overrides; end
|
160
|
+
end
|
161
|
+
|
162
|
+
# This is a private module.
|
163
|
+
#
|
164
|
+
# source://zeitwerk//lib/zeitwerk/internal.rb#4
|
165
|
+
module Zeitwerk::Internal
|
166
|
+
# source://zeitwerk//lib/zeitwerk/internal.rb#5
|
167
|
+
def internal(method_name); end
|
168
|
+
end
|
169
|
+
|
170
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#6
|
171
|
+
class Zeitwerk::Loader
|
172
|
+
include ::Zeitwerk::RealModName
|
173
|
+
include ::Zeitwerk::Loader::Callbacks
|
174
|
+
include ::Zeitwerk::Loader::Helpers
|
175
|
+
include ::Zeitwerk::Loader::Config
|
176
|
+
include ::Zeitwerk::Loader::EagerLoad
|
177
|
+
|
178
|
+
# @return [Loader] a new instance of Loader
|
179
|
+
#
|
180
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#96
|
181
|
+
def initialize; end
|
182
|
+
|
183
|
+
# We keep track of autoloaded directories to remove them from the registry
|
184
|
+
# at the end of eager loading.
|
185
|
+
#
|
186
|
+
# Files are removed as they are autoloaded, but directories need to wait due
|
187
|
+
# to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded).
|
188
|
+
#
|
189
|
+
# @private
|
190
|
+
#
|
191
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#41
|
192
|
+
def autoloaded_dirs; end
|
193
|
+
|
194
|
+
# Maps absolute paths for which an autoload has been set ---and not
|
195
|
+
# executed--- to their corresponding parent class or module and constant
|
196
|
+
# name.
|
197
|
+
#
|
198
|
+
# "/Users/fxn/blog/app/models/user.rb" => [Object, :User],
|
199
|
+
# "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
|
200
|
+
# ...
|
201
|
+
#
|
202
|
+
# @private
|
203
|
+
#
|
204
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#31
|
205
|
+
def autoloads; end
|
206
|
+
|
207
|
+
# @private
|
208
|
+
#
|
209
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#90
|
210
|
+
def mutex; end
|
211
|
+
|
212
|
+
# @private
|
213
|
+
#
|
214
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#94
|
215
|
+
def mutex2; end
|
216
|
+
|
217
|
+
# Maps namespace constant paths to their respective directories.
|
218
|
+
#
|
219
|
+
# For example, given this mapping:
|
220
|
+
#
|
221
|
+
# "Admin" => [
|
222
|
+
# "/Users/fxn/blog/app/controllers/admin",
|
223
|
+
# "/Users/fxn/blog/app/models/admin",
|
224
|
+
# ...
|
225
|
+
# ]
|
226
|
+
#
|
227
|
+
# when `Admin` gets defined we know that it plays the role of a namespace
|
228
|
+
# and that its children are spread over those directories. We'll visit them
|
229
|
+
# to set up the corresponding autoloads.
|
230
|
+
#
|
231
|
+
# @private
|
232
|
+
#
|
233
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#75
|
234
|
+
def namespace_dirs; end
|
235
|
+
|
236
|
+
# Unloads all loaded code, and calls setup again so that the loader is able
|
237
|
+
# to pick any changes in the file system.
|
238
|
+
#
|
239
|
+
# This method is not thread-safe, please see how this can be achieved by
|
240
|
+
# client code in the README of the project.
|
241
|
+
#
|
242
|
+
# @raise [Zeitwerk::Error]
|
243
|
+
#
|
244
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#219
|
245
|
+
def reload; end
|
246
|
+
|
247
|
+
# Sets autoloads in the root namespaces.
|
248
|
+
#
|
249
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#115
|
250
|
+
def setup; end
|
251
|
+
|
252
|
+
# The return value of this predicate is only meaningful if the loader has
|
253
|
+
# scanned the file. This is the case in the spots where we use it.
|
254
|
+
#
|
255
|
+
# @private
|
256
|
+
# @return [Boolean]
|
257
|
+
#
|
258
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#259
|
259
|
+
def shadowed_file?(file); end
|
260
|
+
|
261
|
+
# A shadowed file is a file managed by this loader that is ignored when
|
262
|
+
# setting autoloads because its matching constant is already taken.
|
263
|
+
#
|
264
|
+
# This private set is populated as we descend. For example, if the loader
|
265
|
+
# has only scanned the top-level, `shadowed_files` does not have shadowed
|
266
|
+
# files that may exist deep in the project tree yet.
|
267
|
+
#
|
268
|
+
# @private
|
269
|
+
#
|
270
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#86
|
271
|
+
def shadowed_files; end
|
272
|
+
|
273
|
+
# Stores metadata needed for unloading. Its entries look like this:
|
274
|
+
#
|
275
|
+
# "Admin::Role" => [".../admin/role.rb", [Admin, :Role]]
|
276
|
+
#
|
277
|
+
# The cpath as key helps implementing unloadable_cpath? The file name is
|
278
|
+
# stored in order to be able to delete it from $LOADED_FEATURES, and the
|
279
|
+
# pair [Module, Symbol] is used to remove_const the constant from the class
|
280
|
+
# or module object.
|
281
|
+
#
|
282
|
+
# If reloading is enabled, this hash is filled as constants are autoloaded
|
283
|
+
# or eager loaded. Otherwise, the collection remains empty.
|
284
|
+
#
|
285
|
+
# @private
|
286
|
+
#
|
287
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#57
|
288
|
+
def to_unload; end
|
289
|
+
|
290
|
+
# Removes loaded constants and configured autoloads.
|
291
|
+
#
|
292
|
+
# The objects the constants stored are no longer reachable through them. In
|
293
|
+
# addition, since said objects are normally not referenced from anywhere
|
294
|
+
# else, they are eligible for garbage collection, which would effectively
|
295
|
+
# unload them.
|
296
|
+
#
|
297
|
+
# This method is public but undocumented. Main interface is `reload`, which
|
298
|
+
# means `unload` + `setup`. This one is avaiable to be used together with
|
299
|
+
# `unregister`, which is undocumented too.
|
300
|
+
#
|
301
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#141
|
302
|
+
def unload; end
|
303
|
+
|
304
|
+
# Says if the given constant path would be unloaded on reload. This
|
305
|
+
# predicate returns `false` if reloading is disabled.
|
306
|
+
#
|
307
|
+
# @return [Boolean]
|
308
|
+
#
|
309
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#233
|
310
|
+
def unloadable_cpath?(cpath); end
|
311
|
+
|
312
|
+
# Returns an array with the constant paths that would be unloaded on reload.
|
313
|
+
# This predicate returns an empty array if reloading is disabled.
|
314
|
+
#
|
315
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#241
|
316
|
+
def unloadable_cpaths; end
|
317
|
+
|
318
|
+
# This is a dangerous method.
|
319
|
+
#
|
320
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#249
|
321
|
+
def unregister; end
|
322
|
+
|
323
|
+
private
|
324
|
+
|
325
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#385
|
326
|
+
def autoload_file(parent, cname, file); end
|
327
|
+
|
328
|
+
# @return [Boolean]
|
329
|
+
#
|
330
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#443
|
331
|
+
def autoload_path_set_by_me_for?(parent, cname); end
|
332
|
+
|
333
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#364
|
334
|
+
def autoload_subdir(parent, cname, subdir); end
|
335
|
+
|
336
|
+
# `dir` is the directory that would have autovivified a namespace. `file` is
|
337
|
+
# the file where we've found the namespace is explicitly defined.
|
338
|
+
#
|
339
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#411
|
340
|
+
def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end
|
341
|
+
|
342
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#457
|
343
|
+
def raise_if_conflicting_directory(dir); end
|
344
|
+
|
345
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#452
|
346
|
+
def register_explicit_namespace(cpath); end
|
347
|
+
|
348
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#482
|
349
|
+
def run_on_unload_callbacks(cpath, value, abspath); end
|
350
|
+
|
351
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#422
|
352
|
+
def set_autoload(parent, cname, abspath); end
|
353
|
+
|
354
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#329
|
355
|
+
def set_autoloads_in_dir(dir, parent); end
|
356
|
+
|
357
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#489
|
358
|
+
def unload_autoload(parent, cname); end
|
359
|
+
|
360
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#495
|
361
|
+
def unload_cref(parent, cname); end
|
362
|
+
|
363
|
+
class << self
|
364
|
+
# Returns an array with the absolute paths of the root directories of all
|
365
|
+
# registered loaders. This is a read-only collection.
|
366
|
+
#
|
367
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#321
|
368
|
+
def all_dirs; end
|
369
|
+
|
370
|
+
# Returns the value of attribute default_logger.
|
371
|
+
#
|
372
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#267
|
373
|
+
def default_logger; end
|
374
|
+
|
375
|
+
# Sets the attribute default_logger
|
376
|
+
#
|
377
|
+
# @param value the value to set the attribute default_logger to.
|
378
|
+
#
|
379
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#267
|
380
|
+
def default_logger=(_arg0); end
|
381
|
+
|
382
|
+
# Broadcasts `eager_load` to all loaders. Those that have not been setup
|
383
|
+
# are skipped.
|
384
|
+
#
|
385
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#293
|
386
|
+
def eager_load_all; end
|
387
|
+
|
388
|
+
# Broadcasts `eager_load_namespace` to all loaders. Those that have not
|
389
|
+
# been setup are skipped.
|
390
|
+
#
|
391
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#307
|
392
|
+
def eager_load_namespace(mod); end
|
393
|
+
|
394
|
+
# This is a shortcut for
|
395
|
+
#
|
396
|
+
# require "zeitwerk"
|
397
|
+
# loader = Zeitwerk::Loader.new
|
398
|
+
# loader.tag = File.basename(__FILE__, ".rb")
|
399
|
+
# loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
|
400
|
+
# loader.push_dir(__dir__)
|
401
|
+
#
|
402
|
+
# except that this method returns the same object in subsequent calls from
|
403
|
+
# the same file, in the unlikely case the gem wants to be able to reload.
|
404
|
+
#
|
405
|
+
# This method returns a subclass of Zeitwerk::Loader, but the exact type
|
406
|
+
# is private, client code can only rely on the interface.
|
407
|
+
#
|
408
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#284
|
409
|
+
def for_gem(warn_on_extra_files: T.unsafe(nil)); end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#3
|
414
|
+
module Zeitwerk::Loader::Callbacks
|
415
|
+
include ::Zeitwerk::RealModName
|
416
|
+
|
417
|
+
# Invoked from our decorated Kernel#require when a managed directory is
|
418
|
+
# autoloaded.
|
419
|
+
#
|
420
|
+
# @private
|
421
|
+
#
|
422
|
+
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#34
|
423
|
+
def on_dir_autoloaded(dir); end
|
424
|
+
|
425
|
+
# Invoked from our decorated Kernel#require when a managed file is autoloaded.
|
426
|
+
#
|
427
|
+
# @private
|
428
|
+
#
|
429
|
+
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#10
|
430
|
+
def on_file_autoloaded(file); end
|
431
|
+
|
432
|
+
# Invoked when a class or module is created or reopened, either from the
|
433
|
+
# tracer or from module autovivification. If the namespace has matching
|
434
|
+
# subdirectories, we descend into them now.
|
435
|
+
#
|
436
|
+
# @private
|
437
|
+
#
|
438
|
+
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#73
|
439
|
+
def on_namespace_loaded(namespace); end
|
440
|
+
|
441
|
+
private
|
442
|
+
|
443
|
+
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#84
|
444
|
+
def run_on_load_callbacks(cpath, value, abspath); end
|
445
|
+
end
|
446
|
+
|
447
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#6
|
448
|
+
module Zeitwerk::Loader::Config
|
449
|
+
include ::Zeitwerk::RealModName
|
450
|
+
extend ::Zeitwerk::Internal
|
451
|
+
|
452
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#86
|
453
|
+
def initialize; end
|
454
|
+
|
455
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#287
|
456
|
+
def __ignores?(abspath); end
|
457
|
+
|
458
|
+
def __roots; end
|
459
|
+
|
460
|
+
# Configure directories or glob patterns to be collapsed.
|
461
|
+
#
|
462
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#207
|
463
|
+
def collapse(*glob_patterns); end
|
464
|
+
|
465
|
+
# If `namespaces` is falsey (default), returns an array with the absolute
|
466
|
+
# paths of the root directories as strings. If truthy, returns a hash table
|
467
|
+
# instead. Keys are the absolute paths of the root directories as strings,
|
468
|
+
# values are their corresponding namespaces, class or module objects.
|
469
|
+
#
|
470
|
+
# These are read-only collections, please add to them with `push_dir`.
|
471
|
+
#
|
472
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#155
|
473
|
+
def dirs(namespaces: T.unsafe(nil)); end
|
474
|
+
|
475
|
+
# Let eager load ignore the given files or directories. The constants defined
|
476
|
+
# in those files are still autoloadable.
|
477
|
+
#
|
478
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#189
|
479
|
+
def do_not_eager_load(*paths); end
|
480
|
+
|
481
|
+
# You need to call this method before setup in order to be able to reload.
|
482
|
+
# There is no way to undo this, either you want to reload or you don't.
|
483
|
+
#
|
484
|
+
# @raise [Zeitwerk::Error]
|
485
|
+
#
|
486
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#168
|
487
|
+
def enable_reloading; end
|
488
|
+
|
489
|
+
# Configure files, directories, or glob patterns to be totally ignored.
|
490
|
+
#
|
491
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#196
|
492
|
+
def ignore(*glob_patterns); end
|
493
|
+
|
494
|
+
# Returns the value of attribute inflector.
|
495
|
+
#
|
496
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#11
|
497
|
+
def inflector; end
|
498
|
+
|
499
|
+
# Sets the attribute inflector
|
500
|
+
#
|
501
|
+
# @param value the value to set the attribute inflector to.
|
502
|
+
#
|
503
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#11
|
504
|
+
def inflector=(_arg0); end
|
505
|
+
|
506
|
+
# Logs to `$stdout`, handy shortcut for debugging.
|
507
|
+
#
|
508
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#279
|
509
|
+
def log!; end
|
510
|
+
|
511
|
+
# Returns the value of attribute logger.
|
512
|
+
#
|
513
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#14
|
514
|
+
def logger; end
|
515
|
+
|
516
|
+
# Sets the attribute logger
|
517
|
+
#
|
518
|
+
# @param value the value to set the attribute logger to.
|
519
|
+
#
|
520
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#14
|
521
|
+
def logger=(_arg0); end
|
522
|
+
|
523
|
+
# Configure a block to be invoked once a certain constant path is loaded.
|
524
|
+
# Supports multiple callbacks, and if there are many, they are executed in
|
525
|
+
# the order in which they were defined.
|
526
|
+
#
|
527
|
+
# loader.on_load("SomeApiClient") do |klass, _abspath|
|
528
|
+
# klass.endpoint = "https://api.dev"
|
529
|
+
# end
|
530
|
+
#
|
531
|
+
# Can also be configured for any constant loaded:
|
532
|
+
#
|
533
|
+
# loader.on_load do |cpath, value, abspath|
|
534
|
+
# # ...
|
535
|
+
# end
|
536
|
+
#
|
537
|
+
# @raise [TypeError]
|
538
|
+
#
|
539
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#243
|
540
|
+
def on_load(cpath = T.unsafe(nil), &block); end
|
541
|
+
|
542
|
+
# Configure a block to be called after setup and on each reload.
|
543
|
+
# If setup was already done, the block runs immediately.
|
544
|
+
#
|
545
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#219
|
546
|
+
def on_setup(&block); end
|
547
|
+
|
548
|
+
# Configure a block to be invoked right before a certain constant is removed.
|
549
|
+
# Supports multiple callbacks, and if there are many, they are executed in the
|
550
|
+
# order in which they were defined.
|
551
|
+
#
|
552
|
+
# loader.on_unload("Country") do |klass, _abspath|
|
553
|
+
# klass.clear_cache
|
554
|
+
# end
|
555
|
+
#
|
556
|
+
# Can also be configured for any removed constant:
|
557
|
+
#
|
558
|
+
# loader.on_unload do |cpath, value, abspath|
|
559
|
+
# # ...
|
560
|
+
# end
|
561
|
+
#
|
562
|
+
# @raise [TypeError]
|
563
|
+
#
|
564
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#268
|
565
|
+
def on_unload(cpath = T.unsafe(nil), &block); end
|
566
|
+
|
567
|
+
# Pushes `path` to the list of root directories.
|
568
|
+
#
|
569
|
+
# Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in
|
570
|
+
# the same process already manages that directory or one of its ascendants or
|
571
|
+
# descendants.
|
572
|
+
#
|
573
|
+
# @raise [Zeitwerk::Error]
|
574
|
+
#
|
575
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#111
|
576
|
+
def push_dir(path, namespace: T.unsafe(nil)); end
|
577
|
+
|
578
|
+
# @return [Boolean]
|
579
|
+
#
|
580
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#181
|
581
|
+
def reloading_enabled?; end
|
582
|
+
|
583
|
+
# Returns the loader's tag.
|
584
|
+
#
|
585
|
+
# Implemented as a method instead of via attr_reader for symmetry with the
|
586
|
+
# writer below.
|
587
|
+
#
|
588
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#136
|
589
|
+
def tag; end
|
590
|
+
|
591
|
+
# Sets a tag for the loader, useful for logging.
|
592
|
+
#
|
593
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#143
|
594
|
+
def tag=(tag); end
|
595
|
+
|
596
|
+
private
|
597
|
+
|
598
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#305
|
599
|
+
def actual_roots; end
|
600
|
+
|
601
|
+
# @return [Boolean]
|
602
|
+
#
|
603
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#330
|
604
|
+
def collapse?(dir); end
|
605
|
+
|
606
|
+
# The actual collection of absolute directory names at the time the collapse
|
607
|
+
# glob patterns were expanded. Computed on setup, and recomputed on reload.
|
608
|
+
#
|
609
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#57
|
610
|
+
def collapse_dirs; end
|
611
|
+
|
612
|
+
# Absolute paths of directories or glob patterns to be collapsed.
|
613
|
+
#
|
614
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#50
|
615
|
+
def collapse_glob_patterns; end
|
616
|
+
|
617
|
+
# Absolute paths of files or directories not to be eager loaded.
|
618
|
+
#
|
619
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#63
|
620
|
+
def eager_load_exclusions; end
|
621
|
+
|
622
|
+
# @return [Boolean]
|
623
|
+
#
|
624
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#317
|
625
|
+
def excluded_from_eager_load?(abspath); end
|
626
|
+
|
627
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#340
|
628
|
+
def expand_glob_patterns(glob_patterns); end
|
629
|
+
|
630
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#335
|
631
|
+
def expand_paths(paths); end
|
632
|
+
|
633
|
+
# Absolute paths of files, directories, or glob patterns to be totally
|
634
|
+
# ignored.
|
635
|
+
#
|
636
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#36
|
637
|
+
def ignored_glob_patterns; end
|
638
|
+
|
639
|
+
# @return [Boolean]
|
640
|
+
#
|
641
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#300
|
642
|
+
def ignored_path?(abspath); end
|
643
|
+
|
644
|
+
# The actual collection of absolute file and directory names at the time the
|
645
|
+
# ignored glob patterns were expanded. Computed on setup, and recomputed on
|
646
|
+
# reload.
|
647
|
+
#
|
648
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#44
|
649
|
+
def ignored_paths; end
|
650
|
+
|
651
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#287
|
652
|
+
def ignores?(abspath); end
|
653
|
+
|
654
|
+
# User-oriented callbacks to be fired when a constant is loaded.
|
655
|
+
#
|
656
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#76
|
657
|
+
def on_load_callbacks; end
|
658
|
+
|
659
|
+
# User-oriented callbacks to be fired on setup and on reload.
|
660
|
+
#
|
661
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#69
|
662
|
+
def on_setup_callbacks; end
|
663
|
+
|
664
|
+
# User-oriented callbacks to be fired before constants are removed.
|
665
|
+
#
|
666
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#83
|
667
|
+
def on_unload_callbacks; end
|
668
|
+
|
669
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#352
|
670
|
+
def recompute_collapse_dirs; end
|
671
|
+
|
672
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#347
|
673
|
+
def recompute_ignored_paths; end
|
674
|
+
|
675
|
+
# @return [Boolean]
|
676
|
+
#
|
677
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#312
|
678
|
+
def root_dir?(dir); end
|
679
|
+
|
680
|
+
# Absolute paths of the root directories, mapped to their respective root namespaces:
|
681
|
+
#
|
682
|
+
# "/Users/fxn/blog/app/channels" => Object,
|
683
|
+
# "/Users/fxn/blog/app/adapters" => ActiveJob::QueueAdapters,
|
684
|
+
# ...
|
685
|
+
#
|
686
|
+
# Stored in a hash to preserve order, easily handle duplicates, and have a
|
687
|
+
# fast lookup by directory.
|
688
|
+
#
|
689
|
+
# This is a private collection maintained by the loader. The public
|
690
|
+
# interface for it is `push_dir` and `dirs`.
|
691
|
+
#
|
692
|
+
# source://zeitwerk//lib/zeitwerk/loader/config.rb#29
|
693
|
+
def roots; end
|
694
|
+
end
|
695
|
+
|
696
|
+
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#1
|
697
|
+
module Zeitwerk::Loader::EagerLoad
|
698
|
+
# Eager loads all files in the root directories, recursively. Files do not
|
699
|
+
# need to be in `$LOAD_PATH`, absolute file names are used. Ignored and
|
700
|
+
# shadowed files are not eager loaded. You can opt-out specifically in
|
701
|
+
# specific files and directories with `do_not_eager_load`, and that can be
|
702
|
+
# overridden passing `force: true`.
|
703
|
+
#
|
704
|
+
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#9
|
705
|
+
def eager_load(force: T.unsafe(nil)); end
|
706
|
+
|
707
|
+
# @raise [Zeitwerk::SetupRequired]
|
708
|
+
#
|
709
|
+
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#32
|
710
|
+
def eager_load_dir(path); end
|
711
|
+
|
712
|
+
# @raise [Zeitwerk::SetupRequired]
|
713
|
+
#
|
714
|
+
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#72
|
715
|
+
def eager_load_namespace(mod); end
|
716
|
+
|
717
|
+
# Loads the given Ruby file.
|
718
|
+
#
|
719
|
+
# Raises if the argument is ignored, shadowed, or not managed by the receiver.
|
720
|
+
#
|
721
|
+
# The method is implemented as `constantize` for files, in a sense, to be able
|
722
|
+
# to descend orderly and make sure the file is loadable.
|
723
|
+
#
|
724
|
+
# @raise [Zeitwerk::Error]
|
725
|
+
#
|
726
|
+
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#114
|
727
|
+
def load_file(path); end
|
728
|
+
|
729
|
+
private
|
730
|
+
|
731
|
+
# The caller is responsible for making sure `namespace` is the namespace that
|
732
|
+
# corresponds to `dir`.
|
733
|
+
#
|
734
|
+
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#154
|
735
|
+
def actual_eager_load_dir(dir, namespace, force: T.unsafe(nil)); end
|
736
|
+
|
737
|
+
# In order to invoke this method, the caller has to ensure `child` is a
|
738
|
+
# strict namespace descendendant of `root_namespace`.
|
739
|
+
#
|
740
|
+
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#189
|
741
|
+
def eager_load_child_namespace(child, child_name, root_dir, root_namespace); end
|
742
|
+
end
|
743
|
+
|
744
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#3
|
745
|
+
module Zeitwerk::Loader::Helpers
|
746
|
+
private
|
747
|
+
|
748
|
+
# @return [Boolean]
|
749
|
+
#
|
750
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#128
|
751
|
+
def cdef?(parent, cname); end
|
752
|
+
|
753
|
+
# @raise [NameError]
|
754
|
+
#
|
755
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#134
|
756
|
+
def cget(parent, cname); end
|
757
|
+
|
758
|
+
# Symbol#name was introduced in Ruby 3.0. It returns always the same
|
759
|
+
# frozen object, so we may save a few string allocations.
|
760
|
+
#
|
761
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#118
|
762
|
+
def cpath(parent, cname); end
|
763
|
+
|
764
|
+
# @return [Boolean]
|
765
|
+
#
|
766
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#67
|
767
|
+
def dir?(path); end
|
768
|
+
|
769
|
+
# @return [Boolean]
|
770
|
+
#
|
771
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#45
|
772
|
+
def has_at_least_one_ruby_file?(dir); end
|
773
|
+
|
774
|
+
# @return [Boolean]
|
775
|
+
#
|
776
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#72
|
777
|
+
def hidden?(basename); end
|
778
|
+
|
779
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#7
|
780
|
+
def log(message); end
|
781
|
+
|
782
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#15
|
783
|
+
def ls(dir); end
|
784
|
+
|
785
|
+
# @return [Boolean]
|
786
|
+
#
|
787
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#62
|
788
|
+
def ruby?(path); end
|
789
|
+
|
790
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#109
|
791
|
+
def strict_autoload_path(parent, cname); end
|
792
|
+
|
793
|
+
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#77
|
794
|
+
def walk_up(abspath); end
|
795
|
+
end
|
796
|
+
|
797
|
+
# source://zeitwerk//lib/zeitwerk/loader.rb#18
|
798
|
+
Zeitwerk::Loader::MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
|
799
|
+
|
800
|
+
# source://zeitwerk//lib/zeitwerk/error.rb#13
|
801
|
+
class Zeitwerk::NameError < ::NameError; end
|
802
|
+
|
803
|
+
# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#3
|
804
|
+
module Zeitwerk::RealModName
|
805
|
+
# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#14
|
806
|
+
def real_mod_name(mod); end
|
807
|
+
end
|
808
|
+
|
809
|
+
# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#4
|
810
|
+
Zeitwerk::RealModName::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod)
|
811
|
+
|
812
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#4
|
813
|
+
module Zeitwerk::Registry
|
814
|
+
class << self
|
815
|
+
# Maps absolute paths to the loaders responsible for them.
|
816
|
+
#
|
817
|
+
# This information is used by our decorated `Kernel#require` to be able to
|
818
|
+
# invoke callbacks and autovivify modules.
|
819
|
+
#
|
820
|
+
# @private
|
821
|
+
#
|
822
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#26
|
823
|
+
def autoloads; end
|
824
|
+
|
825
|
+
# Registers gem loaders to let `for_gem` be idempotent in case of reload.
|
826
|
+
#
|
827
|
+
# @private
|
828
|
+
#
|
829
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#17
|
830
|
+
def gem_loaders_by_root_file; end
|
831
|
+
|
832
|
+
# @private
|
833
|
+
# @return [Boolean]
|
834
|
+
#
|
835
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#113
|
836
|
+
def inception?(cpath); end
|
837
|
+
|
838
|
+
# This hash table addresses an edge case in which an autoload is ignored.
|
839
|
+
#
|
840
|
+
# For example, let's suppose we want to autoload in a gem like this:
|
841
|
+
#
|
842
|
+
# # lib/my_gem.rb
|
843
|
+
# loader = Zeitwerk::Loader.new
|
844
|
+
# loader.push_dir(__dir__)
|
845
|
+
# loader.setup
|
846
|
+
#
|
847
|
+
# module MyGem
|
848
|
+
# end
|
849
|
+
#
|
850
|
+
# if you require "my_gem", as Bundler would do, this happens while setting
|
851
|
+
# up autoloads:
|
852
|
+
#
|
853
|
+
# 1. Object.autoload?(:MyGem) returns `nil` because the autoload for
|
854
|
+
# the constant is issued by Zeitwerk while the same file is being
|
855
|
+
# required.
|
856
|
+
# 2. The constant `MyGem` is undefined while setup runs.
|
857
|
+
#
|
858
|
+
# Therefore, a directory `lib/my_gem` would autovivify a module according to
|
859
|
+
# the existing information. But that would be wrong.
|
860
|
+
#
|
861
|
+
# To overcome this fundamental limitation, we keep track of the constant
|
862
|
+
# paths that are in this situation ---in the example above, "MyGem"--- and
|
863
|
+
# take this collection into account for the autovivification logic.
|
864
|
+
#
|
865
|
+
# Note that you cannot generally address this by moving the setup code
|
866
|
+
# below the constant definition, because we want libraries to be able to
|
867
|
+
# use managed constants in the module body:
|
868
|
+
#
|
869
|
+
# module MyGem
|
870
|
+
# include MyConcern
|
871
|
+
# end
|
872
|
+
#
|
873
|
+
# @private
|
874
|
+
#
|
875
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#65
|
876
|
+
def inceptions; end
|
877
|
+
|
878
|
+
# @private
|
879
|
+
#
|
880
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#121
|
881
|
+
def loader_for(path); end
|
882
|
+
|
883
|
+
# This method returns always a loader, the same instance for the same root
|
884
|
+
# file. That is how Zeitwerk::Loader.for_gem is idempotent.
|
885
|
+
#
|
886
|
+
# @private
|
887
|
+
#
|
888
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#89
|
889
|
+
def loader_for_gem(root_file, warn_on_extra_files:); end
|
890
|
+
|
891
|
+
# Keeps track of all loaders. Useful to broadcast messages and to prevent
|
892
|
+
# them from being garbage collected.
|
893
|
+
#
|
894
|
+
# @private
|
895
|
+
#
|
896
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#11
|
897
|
+
def loaders; end
|
898
|
+
|
899
|
+
# @private
|
900
|
+
#
|
901
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#127
|
902
|
+
def on_unload(loader); end
|
903
|
+
|
904
|
+
# @private
|
905
|
+
#
|
906
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#95
|
907
|
+
def register_autoload(loader, abspath); end
|
908
|
+
|
909
|
+
# @private
|
910
|
+
#
|
911
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#107
|
912
|
+
def register_inception(cpath, abspath, loader); end
|
913
|
+
|
914
|
+
# Registers a loader.
|
915
|
+
#
|
916
|
+
# @private
|
917
|
+
#
|
918
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#71
|
919
|
+
def register_loader(loader); end
|
920
|
+
|
921
|
+
# @private
|
922
|
+
#
|
923
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#101
|
924
|
+
def unregister_autoload(abspath); end
|
925
|
+
|
926
|
+
# @private
|
927
|
+
#
|
928
|
+
# source://zeitwerk//lib/zeitwerk/registry.rb#77
|
929
|
+
def unregister_loader(loader); end
|
930
|
+
end
|
931
|
+
end
|
932
|
+
|
933
|
+
# source://zeitwerk//lib/zeitwerk/error.rb#7
|
934
|
+
class Zeitwerk::ReloadingDisabledError < ::Zeitwerk::Error
|
935
|
+
# @return [ReloadingDisabledError] a new instance of ReloadingDisabledError
|
936
|
+
#
|
937
|
+
# source://zeitwerk//lib/zeitwerk/error.rb#8
|
938
|
+
def initialize; end
|
939
|
+
end
|
940
|
+
|
941
|
+
# source://zeitwerk//lib/zeitwerk/error.rb#16
|
942
|
+
class Zeitwerk::SetupRequired < ::Zeitwerk::Error
|
943
|
+
# @return [SetupRequired] a new instance of SetupRequired
|
944
|
+
#
|
945
|
+
# source://zeitwerk//lib/zeitwerk/error.rb#17
|
946
|
+
def initialize; end
|
947
|
+
end
|
948
|
+
|
949
|
+
# source://zeitwerk//lib/zeitwerk/version.rb#4
|
950
|
+
Zeitwerk::VERSION = T.let(T.unsafe(nil), String)
|