whatsapp_sdk 0.12.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.cursorrules +53 -0
  3. data/.github/workflows/codeql-analysis.yml +8 -6
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +0 -3
  6. data/CHANGELOG.md +19 -7
  7. data/Gemfile +1 -4
  8. data/Gemfile.lock +9 -23
  9. data/README.md +148 -223
  10. data/SECURITY.md +21 -0
  11. data/example.rb +217 -125
  12. data/lib/whatsapp_sdk/api/api_configuration.rb +2 -5
  13. data/lib/whatsapp_sdk/api/business_profile.rb +12 -26
  14. data/lib/whatsapp_sdk/api/client.rb +31 -43
  15. data/lib/whatsapp_sdk/api/medias.rb +31 -46
  16. data/lib/whatsapp_sdk/api/messages.rb +28 -142
  17. data/lib/whatsapp_sdk/api/phone_numbers.rb +32 -36
  18. data/lib/whatsapp_sdk/api/request.rb +2 -2
  19. data/lib/whatsapp_sdk/api/responses/generic_error_response.rb +12 -30
  20. data/lib/whatsapp_sdk/api/responses/http_response_error.rb +18 -0
  21. data/lib/whatsapp_sdk/api/responses/id_response.rb +15 -0
  22. data/lib/whatsapp_sdk/api/responses/message_data_response.rb +18 -37
  23. data/lib/whatsapp_sdk/api/responses/pagination_records.rb +17 -0
  24. data/lib/whatsapp_sdk/api/responses/success_response.rb +3 -20
  25. data/lib/whatsapp_sdk/api/templates.rb +30 -63
  26. data/lib/whatsapp_sdk/configuration.rb +2 -24
  27. data/lib/whatsapp_sdk/error.rb +0 -1
  28. data/lib/whatsapp_sdk/resource/address.rb +1 -30
  29. data/lib/whatsapp_sdk/resource/address_type.rb +3 -8
  30. data/lib/whatsapp_sdk/resource/business_profile.rb +28 -3
  31. data/lib/whatsapp_sdk/resource/button_parameter.rb +4 -20
  32. data/lib/whatsapp_sdk/resource/component.rb +12 -43
  33. data/lib/whatsapp_sdk/resource/contact.rb +1 -30
  34. data/lib/whatsapp_sdk/resource/contact_response.rb +1 -9
  35. data/lib/whatsapp_sdk/resource/currency.rb +0 -8
  36. data/lib/whatsapp_sdk/resource/date_time.rb +0 -6
  37. data/lib/whatsapp_sdk/resource/email.rb +1 -10
  38. data/lib/whatsapp_sdk/resource/errors.rb +3 -17
  39. data/lib/whatsapp_sdk/resource/interactive.rb +6 -27
  40. data/lib/whatsapp_sdk/resource/interactive_action.rb +10 -24
  41. data/lib/whatsapp_sdk/resource/interactive_action_reply_button.rb +5 -19
  42. data/lib/whatsapp_sdk/resource/interactive_action_section.rb +1 -11
  43. data/lib/whatsapp_sdk/resource/interactive_action_section_row.rb +0 -11
  44. data/lib/whatsapp_sdk/resource/interactive_body.rb +0 -10
  45. data/lib/whatsapp_sdk/resource/interactive_footer.rb +0 -10
  46. data/lib/whatsapp_sdk/resource/interactive_header.rb +25 -53
  47. data/lib/whatsapp_sdk/resource/location.rb +44 -0
  48. data/lib/whatsapp_sdk/resource/media.rb +28 -114
  49. data/lib/whatsapp_sdk/resource/media_component.rb +89 -0
  50. data/lib/whatsapp_sdk/resource/media_types.rb +0 -3
  51. data/lib/whatsapp_sdk/resource/message.rb +0 -5
  52. data/lib/whatsapp_sdk/resource/message_template_namespace.rb +17 -0
  53. data/lib/whatsapp_sdk/resource/name.rb +1 -28
  54. data/lib/whatsapp_sdk/resource/org.rb +1 -13
  55. data/lib/whatsapp_sdk/resource/parameter_object.rb +71 -74
  56. data/lib/whatsapp_sdk/resource/phone_number.rb +40 -22
  57. data/lib/whatsapp_sdk/resource/phone_number_component.rb +25 -0
  58. data/lib/whatsapp_sdk/resource/template.rb +43 -36
  59. data/lib/whatsapp_sdk/resource/url.rb +1 -10
  60. data/lib/whatsapp_sdk/version.rb +1 -2
  61. data/lib/whatsapp_sdk.rb +0 -4
  62. data/whatsapp_sdk.gemspec +1 -4
  63. metadata +13 -62
  64. data/lib/whatsapp_sdk/api/response.rb +0 -51
  65. data/lib/whatsapp_sdk/api/responses/business_profile_data_response.rb +0 -56
  66. data/lib/whatsapp_sdk/api/responses/data_response.rb +0 -26
  67. data/lib/whatsapp_sdk/api/responses/error_response.rb +0 -32
  68. data/lib/whatsapp_sdk/api/responses/media_data_response.rb +0 -48
  69. data/lib/whatsapp_sdk/api/responses/message_error_response.rb +0 -13
  70. data/lib/whatsapp_sdk/api/responses/message_template_namespace_data_response.rb +0 -37
  71. data/lib/whatsapp_sdk/api/responses/phone_number_data_response.rb +0 -60
  72. data/lib/whatsapp_sdk/api/responses/phone_numbers_data_response.rb +0 -39
  73. data/lib/whatsapp_sdk/api/responses/read_message_data_response.rb +0 -34
  74. data/lib/whatsapp_sdk/api/responses/template_data_response.rb +0 -51
  75. data/lib/whatsapp_sdk/api/responses/templates_data_response.rb +0 -39
  76. data/sorbet/config +0 -6
  77. data/sorbet/rbi/annotations/faraday.rbi +0 -17
  78. data/sorbet/rbi/annotations/mocha.rbi +0 -34
  79. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  80. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +0 -270
  81. data/sorbet/rbi/gems/faraday-net_http@2.0.3.rbi +0 -182
  82. data/sorbet/rbi/gems/faraday@2.3.0.rbi +0 -2494
  83. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -272
  84. data/sorbet/rbi/gems/minitest@5.16.1.rbi +0 -1459
  85. data/sorbet/rbi/gems/mocha@1.14.0.rbi +0 -60
  86. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +0 -239
  87. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -150
  88. data/sorbet/rbi/gems/oj@3.13.14.rbi +0 -589
  89. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +0 -867
  90. data/sorbet/rbi/todo.rbi +0 -8
  91. data/sorbet/shims/request.rbi +0 -10
  92. data/sorbet/tapioca/config.yml +0 -13
  93. data/sorbet/tapioca/require.rb +0 -4
@@ -1,867 +0,0 @@
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
- # Kernel extensions for minitest
8
- #
9
- # source://zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:3
10
- module Kernel
11
- private
12
-
13
- # source://zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:24
14
- def require(path); end
15
-
16
- class << self
17
- # source://zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:24
18
- def require(path); end
19
- end
20
- end
21
-
22
- # source://zeitwerk-2.6.0/lib/zeitwerk.rb:3
23
- module Zeitwerk
24
- class << self
25
- # This is a dangerous method.
26
- #
27
- # source://zeitwerk-2.6.0/lib/zeitwerk.rb:19
28
- def with_loader; end
29
- end
30
- end
31
-
32
- # source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:4
33
- class Zeitwerk::Error < ::StandardError; end
34
-
35
- # Centralizes the logic for the trace point used to detect the creation of
36
- # explicit namespaces, needed to descend into matching subdirectories right
37
- # after the constant has been defined.
38
- #
39
- # The implementation assumes an explicit namespace is managed by one loader.
40
- # Loaders that reopen namespaces owned by other projects are responsible for
41
- # loading their constant before setup. This is documented.
42
- #
43
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:11
44
- module Zeitwerk::ExplicitNamespace
45
- extend ::Zeitwerk::RealModName
46
-
47
- class << self
48
- # Maps constant paths that correspond to explicit namespaces according to
49
- # the file system, to the loader responsible for them.
50
- #
51
- # @private
52
- #
53
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:20
54
- def cpaths; end
55
-
56
- # @private
57
- #
58
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:24
59
- def mutex; end
60
-
61
- # Asserts `cpath` corresponds to an explicit namespace for which `loader`
62
- # is responsible.
63
- #
64
- # @private
65
- #
66
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:35
67
- def register(cpath, loader); end
68
-
69
- # @private
70
- #
71
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:28
72
- def tracer; end
73
-
74
- # @private
75
- #
76
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:46
77
- def unregister_loader(loader); end
78
-
79
- private
80
-
81
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:54
82
- def disable_tracer_if_unneeded; end
83
-
84
- # source://zeitwerk-2.6.0/lib/zeitwerk/explicit_namespace.rb:61
85
- def tracepoint_class_callback(event); end
86
- end
87
- end
88
-
89
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_inflector.rb:5
90
- class Zeitwerk::GemInflector < ::Zeitwerk::Inflector
91
- # @return [GemInflector] a new instance of GemInflector
92
- #
93
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_inflector.rb:6
94
- def initialize(root_file); end
95
-
96
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_inflector.rb:13
97
- def camelize(basename, abspath); end
98
- end
99
-
100
- # @private
101
- #
102
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:7
103
- class Zeitwerk::GemLoader < ::Zeitwerk::Loader
104
- # @return [GemLoader] a new instance of GemLoader
105
- #
106
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:17
107
- def initialize(root_file, warn_on_extra_files:); end
108
-
109
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:30
110
- def setup; end
111
-
112
- private
113
-
114
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:38
115
- def warn_on_extra_files; end
116
-
117
- class << self
118
- # @private
119
- #
120
- # source://zeitwerk-2.6.0/lib/zeitwerk/gem_loader.rb:12
121
- def _new(root_file, warn_on_extra_files:); end
122
- end
123
- end
124
-
125
- # source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:4
126
- class Zeitwerk::Inflector
127
- # Very basic snake case -> camel case conversion.
128
- #
129
- # inflector = Zeitwerk::Inflector.new
130
- # inflector.camelize("post", ...) # => "Post"
131
- # inflector.camelize("users_controller", ...) # => "UsersController"
132
- # inflector.camelize("api", ...) # => "Api"
133
- #
134
- # Takes into account hard-coded mappings configured with `inflect`.
135
- #
136
- # source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:15
137
- def camelize(basename, _abspath); end
138
-
139
- # Configures hard-coded inflections:
140
- #
141
- # inflector = Zeitwerk::Inflector.new
142
- # inflector.inflect(
143
- # "html_parser" => "HTMLParser",
144
- # "mysql_adapter" => "MySQLAdapter"
145
- # )
146
- #
147
- # inflector.camelize("html_parser", abspath) # => "HTMLParser"
148
- # inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter"
149
- # inflector.camelize("users_controller", abspath) # => "UsersController"
150
- #
151
- # source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:32
152
- def inflect(inflections); end
153
-
154
- private
155
-
156
- # Hard-coded basename to constant name user maps that override the default
157
- # inflection logic.
158
- #
159
- # source://zeitwerk-2.6.0/lib/zeitwerk/inflector.rb:42
160
- def overrides; end
161
- end
162
-
163
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:6
164
- class Zeitwerk::Loader
165
- include ::Zeitwerk::RealModName
166
- include ::Zeitwerk::Loader::Callbacks
167
- include ::Zeitwerk::Loader::Helpers
168
- include ::Zeitwerk::Loader::Config
169
-
170
- # @return [Loader] a new instance of Loader
171
- #
172
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:83
173
- def initialize; end
174
-
175
- # We keep track of autoloaded directories to remove them from the registry
176
- # at the end of eager loading.
177
- #
178
- # Files are removed as they are autoloaded, but directories need to wait due
179
- # to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded).
180
- #
181
- # @private
182
- #
183
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:39
184
- def autoloaded_dirs; end
185
-
186
- # Maps absolute paths for which an autoload has been set ---and not
187
- # executed--- to their corresponding parent class or module and constant
188
- # name.
189
- #
190
- # "/Users/fxn/blog/app/models/user.rb" => [Object, :User],
191
- # "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
192
- # ...
193
- #
194
- # @private
195
- #
196
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:29
197
- def autoloads; end
198
-
199
- # Eager loads all files in the root directories, recursively. Files do not
200
- # need to be in `$LOAD_PATH`, absolute file names are used. Ignored files
201
- # are not eager loaded. You can opt-out specifically in specific files and
202
- # directories with `do_not_eager_load`, and that can be overridden passing
203
- # `force: true`.
204
- #
205
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:218
206
- def eager_load(force: T.unsafe(nil)); end
207
-
208
- # Maps constant paths of namespaces to arrays of corresponding directories.
209
- #
210
- # For example, given this mapping:
211
- #
212
- # "Admin" => [
213
- # "/Users/fxn/blog/app/controllers/admin",
214
- # "/Users/fxn/blog/app/models/admin",
215
- # ...
216
- # ]
217
- #
218
- # when `Admin` gets defined we know that it plays the role of a namespace and
219
- # that its children are spread over those directories. We'll visit them to set
220
- # up the corresponding autoloads.
221
- #
222
- # @private
223
- #
224
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:73
225
- def lazy_subdirs; end
226
-
227
- # @private
228
- #
229
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:77
230
- def mutex; end
231
-
232
- # @private
233
- #
234
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:81
235
- def mutex2; end
236
-
237
- # Unloads all loaded code, and calls setup again so that the loader is able
238
- # to pick any changes in the file system.
239
- #
240
- # This method is not thread-safe, please see how this can be achieved by
241
- # client code in the README of the project.
242
- #
243
- # @raise [Zeitwerk::Error]
244
- #
245
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:202
246
- def reload; end
247
-
248
- # Sets autoloads in the root namespace.
249
- #
250
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:101
251
- def setup; end
252
-
253
- # Stores metadata needed for unloading. Its entries look like this:
254
- #
255
- # "Admin::Role" => [".../admin/role.rb", [Admin, :Role]]
256
- #
257
- # The cpath as key helps implementing unloadable_cpath? The file name is
258
- # stored in order to be able to delete it from $LOADED_FEATURES, and the
259
- # pair [Module, Symbol] is used to remove_const the constant from the class
260
- # or module object.
261
- #
262
- # If reloading is enabled, this hash is filled as constants are autoloaded
263
- # or eager loaded. Otherwise, the collection remains empty.
264
- #
265
- # @private
266
- #
267
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:55
268
- def to_unload; end
269
-
270
- # Removes loaded constants and configured autoloads.
271
- #
272
- # The objects the constants stored are no longer reachable through them. In
273
- # addition, since said objects are normally not referenced from anywhere
274
- # else, they are eligible for garbage collection, which would effectively
275
- # unload them.
276
- #
277
- # This method is public but undocumented. Main interface is `reload`, which
278
- # means `unload` + `setup`. This one is avaiable to be used together with
279
- # `unregister`, which is undocumented too.
280
- #
281
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:127
282
- def unload; end
283
-
284
- # Says if the given constant path would be unloaded on reload. This
285
- # predicate returns `false` if reloading is disabled.
286
- #
287
- # @return [Boolean]
288
- #
289
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:267
290
- def unloadable_cpath?(cpath); end
291
-
292
- # Returns an array with the constant paths that would be unloaded on reload.
293
- # This predicate returns an empty array if reloading is disabled.
294
- #
295
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:275
296
- def unloadable_cpaths; end
297
-
298
- # This is a dangerous method.
299
- #
300
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:283
301
- def unregister; end
302
-
303
- private
304
-
305
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:397
306
- def autoload_file(parent, cname, file); end
307
-
308
- # @return [Boolean]
309
- #
310
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:453
311
- def autoload_path_set_by_me_for?(parent, cname); end
312
-
313
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:376
314
- def autoload_subdir(parent, cname, subdir); end
315
-
316
- # `dir` is the directory that would have autovivified a namespace. `file` is
317
- # the file where we've found the namespace is explicitly defined.
318
- #
319
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:421
320
- def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end
321
-
322
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:467
323
- def raise_if_conflicting_directory(dir); end
324
-
325
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:462
326
- def register_explicit_namespace(cpath); end
327
-
328
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:491
329
- def run_on_unload_callbacks(cpath, value, abspath); end
330
-
331
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:432
332
- def set_autoload(parent, cname, abspath); end
333
-
334
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:333
335
- def set_autoloads_in_dir(dir, parent); end
336
-
337
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:498
338
- def unload_autoload(parent, cname); end
339
-
340
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:504
341
- def unload_cref(parent, cname); end
342
-
343
- class << self
344
- # Returns an array with the absolute paths of the root directories of all
345
- # registered loaders. This is a read-only collection.
346
- #
347
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:325
348
- def all_dirs; end
349
-
350
- # Returns the value of attribute default_logger.
351
- #
352
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:292
353
- def default_logger; end
354
-
355
- # Sets the attribute default_logger
356
- #
357
- # @param value the value to set the attribute default_logger to.
358
- #
359
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:292
360
- def default_logger=(_arg0); end
361
-
362
- # Broadcasts `eager_load` to all loaders.
363
- #
364
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:317
365
- def eager_load_all; end
366
-
367
- # This is a shortcut for
368
- #
369
- # require "zeitwerk"
370
- # loader = Zeitwerk::Loader.new
371
- # loader.tag = File.basename(__FILE__, ".rb")
372
- # loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
373
- # loader.push_dir(__dir__)
374
- #
375
- # except that this method returns the same object in subsequent calls from
376
- # the same file, in the unlikely case the gem wants to be able to reload.
377
- #
378
- # This method returns a subclass of Zeitwerk::Loader, but the exact type
379
- # is private, client code can only rely on the interface.
380
- #
381
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:309
382
- def for_gem(warn_on_extra_files: T.unsafe(nil)); end
383
- end
384
- end
385
-
386
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:3
387
- module Zeitwerk::Loader::Callbacks
388
- include ::Zeitwerk::RealModName
389
-
390
- # Invoked from our decorated Kernel#require when a managed directory is
391
- # autoloaded.
392
- #
393
- # @private
394
- #
395
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:34
396
- def on_dir_autoloaded(dir); end
397
-
398
- # Invoked from our decorated Kernel#require when a managed file is autoloaded.
399
- #
400
- # @private
401
- #
402
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:10
403
- def on_file_autoloaded(file); end
404
-
405
- # Invoked when a class or module is created or reopened, either from the
406
- # tracer or from module autovivification. If the namespace has matching
407
- # subdirectories, we descend into them now.
408
- #
409
- # @private
410
- #
411
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:73
412
- def on_namespace_loaded(namespace); end
413
-
414
- private
415
-
416
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/callbacks.rb:84
417
- def run_on_load_callbacks(cpath, value, abspath); end
418
- end
419
-
420
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:6
421
- module Zeitwerk::Loader::Config
422
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:82
423
- def initialize; end
424
-
425
- # Configure directories or glob patterns to be collapsed.
426
- #
427
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:191
428
- def collapse(*glob_patterns); end
429
-
430
- # The actual collection of absolute directory names at the time the collapse
431
- # glob patterns were expanded. Computed on setup, and recomputed on reload.
432
- #
433
- # @private
434
- #
435
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:51
436
- def collapse_dirs; end
437
-
438
- # Absolute paths of directories or glob patterns to be collapsed.
439
- #
440
- # @private
441
- #
442
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:44
443
- def collapse_glob_patterns; end
444
-
445
- # Absolute paths of the root directories. This is a read-only collection,
446
- # please push here via `push_dir`.
447
- #
448
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:143
449
- def dirs; end
450
-
451
- # Let eager load ignore the given files or directories. The constants defined
452
- # in those files are still autoloadable.
453
- #
454
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:173
455
- def do_not_eager_load(*paths); end
456
-
457
- # Absolute paths of files or directories not to be eager loaded.
458
- #
459
- # @private
460
- #
461
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:57
462
- def eager_load_exclusions; end
463
-
464
- # You need to call this method before setup in order to be able to reload.
465
- # There is no way to undo this, either you want to reload or you don't.
466
- #
467
- # @raise [Zeitwerk::Error]
468
- #
469
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:152
470
- def enable_reloading; end
471
-
472
- # Configure files, directories, or glob patterns to be totally ignored.
473
- #
474
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:180
475
- def ignore(*glob_patterns); end
476
-
477
- # Absolute paths of files, directories, or glob patterns to be totally
478
- # ignored.
479
- #
480
- # @private
481
- #
482
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:30
483
- def ignored_glob_patterns; end
484
-
485
- # The actual collection of absolute file and directory names at the time the
486
- # ignored glob patterns were expanded. Computed on setup, and recomputed on
487
- # reload.
488
- #
489
- # @private
490
- #
491
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:38
492
- def ignored_paths; end
493
-
494
- # @private
495
- # @return [Boolean]
496
- #
497
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:269
498
- def ignores?(abspath); end
499
-
500
- # Returns the value of attribute inflector.
501
- #
502
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:23
503
- def inflector; end
504
-
505
- # Sets the attribute inflector
506
- #
507
- # @param value the value to set the attribute inflector to.
508
- #
509
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:23
510
- def inflector=(_arg0); end
511
-
512
- # Logs to `$stdout`, handy shortcut for debugging.
513
- #
514
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:263
515
- def log!; end
516
-
517
- # Returns the value of attribute logger.
518
- #
519
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:80
520
- def logger; end
521
-
522
- # Sets the attribute logger
523
- #
524
- # @param value the value to set the attribute logger to.
525
- #
526
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:80
527
- def logger=(_arg0); end
528
-
529
- # Configure a block to be invoked once a certain constant path is loaded.
530
- # Supports multiple callbacks, and if there are many, they are executed in
531
- # the order in which they were defined.
532
- #
533
- # loader.on_load("SomeApiClient") do |klass, _abspath|
534
- # klass.endpoint = "https://api.dev"
535
- # end
536
- #
537
- # Can also be configured for any constant loaded:
538
- #
539
- # loader.on_load do |cpath, value, abspath|
540
- # # ...
541
- # end
542
- #
543
- # @raise [TypeError]
544
- #
545
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:227
546
- def on_load(cpath = T.unsafe(nil), &block); end
547
-
548
- # User-oriented callbacks to be fired when a constant is loaded.
549
- #
550
- # @private
551
- #
552
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:70
553
- def on_load_callbacks; end
554
-
555
- # Configure a block to be called after setup and on each reload.
556
- # If setup was already done, the block runs immediately.
557
- #
558
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:203
559
- def on_setup(&block); end
560
-
561
- # User-oriented callbacks to be fired on setup and on reload.
562
- #
563
- # @private
564
- #
565
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:63
566
- def on_setup_callbacks; end
567
-
568
- # Configure a block to be invoked right before a certain constant is removed.
569
- # Supports multiple callbacks, and if there are many, they are executed in the
570
- # order in which they were defined.
571
- #
572
- # loader.on_unload("Country") do |klass, _abspath|
573
- # klass.clear_cache
574
- # end
575
- #
576
- # Can also be configured for any removed constant:
577
- #
578
- # loader.on_unload do |cpath, value, abspath|
579
- # # ...
580
- # end
581
- #
582
- # @raise [TypeError]
583
- #
584
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:252
585
- def on_unload(cpath = T.unsafe(nil), &block); end
586
-
587
- # User-oriented callbacks to be fired before constants are removed.
588
- #
589
- # @private
590
- #
591
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:77
592
- def on_unload_callbacks; end
593
-
594
- # Pushes `path` to the list of root directories.
595
- #
596
- # Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in
597
- # the same process already manages that directory or one of its ascendants or
598
- # descendants.
599
- #
600
- # @raise [Zeitwerk::Error]
601
- #
602
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:107
603
- def push_dir(path, namespace: T.unsafe(nil)); end
604
-
605
- # @return [Boolean]
606
- #
607
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:165
608
- def reloading_enabled?; end
609
-
610
- # Absolute paths of the root directories. Stored in a hash to preserve
611
- # order, easily handle duplicates, and also be able to have a fast lookup,
612
- # needed for detecting nested paths.
613
- #
614
- # "/Users/fxn/blog/app/assets" => true,
615
- # "/Users/fxn/blog/app/channels" => true,
616
- # ...
617
- #
618
- # This is a private collection maintained by the loader. The public
619
- # interface for it is `push_dir` and `dirs`.
620
- #
621
- # @private
622
- #
623
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:20
624
- def root_dirs; end
625
-
626
- # Returns the loader's tag.
627
- #
628
- # Implemented as a method instead of via attr_reader for symmetry with the
629
- # writer below.
630
- #
631
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:128
632
- def tag; end
633
-
634
- # Sets a tag for the loader, useful for logging.
635
- #
636
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:135
637
- def tag=(tag); end
638
-
639
- private
640
-
641
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:278
642
- def actual_root_dirs; end
643
-
644
- # @return [Boolean]
645
- #
646
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:295
647
- def collapse?(dir); end
648
-
649
- # @return [Boolean]
650
- #
651
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:290
652
- def excluded_from_eager_load?(abspath); end
653
-
654
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:305
655
- def expand_glob_patterns(glob_patterns); end
656
-
657
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:300
658
- def expand_paths(paths); end
659
-
660
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:317
661
- def recompute_collapse_dirs; end
662
-
663
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:312
664
- def recompute_ignored_paths; end
665
-
666
- # @return [Boolean]
667
- #
668
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/config.rb:285
669
- def root_dir?(dir); end
670
- end
671
-
672
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:3
673
- module Zeitwerk::Loader::Helpers
674
- private
675
-
676
- # @return [Boolean]
677
- #
678
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:120
679
- def cdef?(parent, cname); end
680
-
681
- # @raise [NameError]
682
- #
683
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:126
684
- def cget(parent, cname); end
685
-
686
- # Symbol#name was introduced in Ruby 3.0. It returns always the same
687
- # frozen object, so we may save a few string allocations.
688
- #
689
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:110
690
- def cpath(parent, cname); end
691
-
692
- # @return [Boolean]
693
- #
694
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:68
695
- def dir?(path); end
696
-
697
- # @return [Boolean]
698
- #
699
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:46
700
- def has_at_least_one_ruby_file?(dir); end
701
-
702
- # @return [Boolean]
703
- #
704
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:73
705
- def hidden?(basename); end
706
-
707
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:9
708
- def log(message); end
709
-
710
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:17
711
- def ls(dir); end
712
-
713
- # @return [Boolean]
714
- #
715
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:63
716
- def ruby?(path); end
717
-
718
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader/helpers.rb:101
719
- def strict_autoload_path(parent, cname); end
720
- end
721
-
722
- # source://zeitwerk-2.6.0/lib/zeitwerk/loader.rb:16
723
- Zeitwerk::Loader::MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
724
-
725
- # source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:13
726
- class Zeitwerk::NameError < ::NameError; end
727
-
728
- # source://zeitwerk-2.6.0/lib/zeitwerk/real_mod_name.rb:3
729
- module Zeitwerk::RealModName
730
- # source://zeitwerk-2.6.0/lib/zeitwerk/real_mod_name.rb:14
731
- def real_mod_name(mod); end
732
- end
733
-
734
- # source://zeitwerk-2.6.0/lib/zeitwerk/real_mod_name.rb:4
735
- Zeitwerk::RealModName::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod)
736
-
737
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:4
738
- module Zeitwerk::Registry
739
- class << self
740
- # Maps absolute paths to the loaders responsible for them.
741
- #
742
- # This information is used by our decorated `Kernel#require` to be able to
743
- # invoke callbacks and autovivify modules.
744
- #
745
- # @private
746
- #
747
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:26
748
- def autoloads; end
749
-
750
- # Registers gem loaders to let `for_gem` be idempotent in case of reload.
751
- #
752
- # @private
753
- #
754
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:17
755
- def gem_loaders_by_root_file; end
756
-
757
- # @private
758
- # @return [Boolean]
759
- #
760
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:113
761
- def inception?(cpath); end
762
-
763
- # This hash table addresses an edge case in which an autoload is ignored.
764
- #
765
- # For example, let's suppose we want to autoload in a gem like this:
766
- #
767
- # # lib/my_gem.rb
768
- # loader = Zeitwerk::Loader.new
769
- # loader.push_dir(__dir__)
770
- # loader.setup
771
- #
772
- # module MyGem
773
- # end
774
- #
775
- # if you require "my_gem", as Bundler would do, this happens while setting
776
- # up autoloads:
777
- #
778
- # 1. Object.autoload?(:MyGem) returns `nil` because the autoload for
779
- # the constant is issued by Zeitwerk while the same file is being
780
- # required.
781
- # 2. The constant `MyGem` is undefined while setup runs.
782
- #
783
- # Therefore, a directory `lib/my_gem` would autovivify a module according to
784
- # the existing information. But that would be wrong.
785
- #
786
- # To overcome this fundamental limitation, we keep track of the constant
787
- # paths that are in this situation ---in the example above, "MyGem"--- and
788
- # take this collection into account for the autovivification logic.
789
- #
790
- # Note that you cannot generally address this by moving the setup code
791
- # below the constant definition, because we want libraries to be able to
792
- # use managed constants in the module body:
793
- #
794
- # module MyGem
795
- # include MyConcern
796
- # end
797
- #
798
- # @private
799
- #
800
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:65
801
- def inceptions; end
802
-
803
- # @private
804
- #
805
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:121
806
- def loader_for(path); end
807
-
808
- # This method returns always a loader, the same instance for the same root
809
- # file. That is how Zeitwerk::Loader.for_gem is idempotent.
810
- #
811
- # @private
812
- #
813
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:89
814
- def loader_for_gem(root_file, warn_on_extra_files:); end
815
-
816
- # Keeps track of all loaders. Useful to broadcast messages and to prevent
817
- # them from being garbage collected.
818
- #
819
- # @private
820
- #
821
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:11
822
- def loaders; end
823
-
824
- # @private
825
- #
826
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:127
827
- def on_unload(loader); end
828
-
829
- # @private
830
- #
831
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:95
832
- def register_autoload(loader, abspath); end
833
-
834
- # @private
835
- #
836
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:107
837
- def register_inception(cpath, abspath, loader); end
838
-
839
- # Registers a loader.
840
- #
841
- # @private
842
- #
843
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:71
844
- def register_loader(loader); end
845
-
846
- # @private
847
- #
848
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:101
849
- def unregister_autoload(abspath); end
850
-
851
- # @private
852
- #
853
- # source://zeitwerk-2.6.0/lib/zeitwerk/registry.rb:77
854
- def unregister_loader(loader); end
855
- end
856
- end
857
-
858
- # source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:7
859
- class Zeitwerk::ReloadingDisabledError < ::Zeitwerk::Error
860
- # @return [ReloadingDisabledError] a new instance of ReloadingDisabledError
861
- #
862
- # source://zeitwerk-2.6.0/lib/zeitwerk/error.rb:8
863
- def initialize; end
864
- end
865
-
866
- # source://zeitwerk-2.6.0/lib/zeitwerk/version.rb:4
867
- Zeitwerk::VERSION = T.let(T.unsafe(nil), String)