File tree Expand file tree Collapse file tree 4 files changed +11
-36
lines changed Expand file tree Collapse file tree 4 files changed +11
-36
lines changed Original file line number Diff line number Diff line change @@ -513,11 +513,7 @@ def migration_railties # :nodoc:
513
513
514
514
# Eager loads the application code.
515
515
def eager_load!
516
- if Rails . autoloaders . zeitwerk_enabled?
517
- Rails . autoloaders . each ( &:eager_load )
518
- else
519
- super
520
- end
516
+ Rails . autoloaders . each ( &:eager_load )
521
517
end
522
518
523
519
protected
Original file line number Diff line number Diff line change @@ -9,28 +9,22 @@ class << self
9
9
include Enumerable
10
10
11
11
def main
12
- if zeitwerk_enabled?
13
- @main ||= Zeitwerk ::Loader . new . tap do |loader |
14
- loader . tag = "rails.main"
15
- loader . inflector = ActiveSupport ::Dependencies ::ZeitwerkIntegration ::Inflector
16
- end
12
+ @main ||= Zeitwerk ::Loader . new . tap do |loader |
13
+ loader . tag = "rails.main"
14
+ loader . inflector = ActiveSupport ::Dependencies ::ZeitwerkIntegration ::Inflector
17
15
end
18
16
end
19
17
20
18
def once
21
- if zeitwerk_enabled?
22
- @once ||= Zeitwerk ::Loader . new . tap do |loader |
23
- loader . tag = "rails.once"
24
- loader . inflector = ActiveSupport ::Dependencies ::ZeitwerkIntegration ::Inflector
25
- end
19
+ @once ||= Zeitwerk ::Loader . new . tap do |loader |
20
+ loader . tag = "rails.once"
21
+ loader . inflector = ActiveSupport ::Dependencies ::ZeitwerkIntegration ::Inflector
26
22
end
27
23
end
28
24
29
25
def each
30
- if zeitwerk_enabled?
31
- yield main
32
- yield once
33
- end
26
+ yield main
27
+ yield once
34
28
end
35
29
36
30
def logger = ( logger )
Original file line number Diff line number Diff line change @@ -482,17 +482,8 @@ def load_server(app = self)
482
482
end
483
483
484
484
def eager_load!
485
- # Already done by Zeitwerk::Loader.eager_load_all. We need this guard to
486
- # easily provide a compatible API for both zeitwerk and classic modes.
487
- return if Rails . autoloaders . zeitwerk_enabled?
488
-
489
- config . eager_load_paths . each do |load_path |
490
- # Starts after load_path plus a slash, ends before ".rb".
491
- relname_range = ( load_path . to_s . length + 1 ) ...-3
492
- Dir . glob ( "#{ load_path } /**/*.rb" ) . sort . each do |file |
493
- require_dependency file [ relname_range ]
494
- end
495
- end
485
+ # Already done by Zeitwerk::Loader.eager_load_all. By now, we leave the
486
+ # method as a no-op for backwards compatibility.
496
487
end
497
488
498
489
def railties
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- ensure_zeitwerk_mode = -> ( ) do
4
- unless Rails . autoloaders . zeitwerk_enabled?
5
- abort "Please, enable :zeitwerk mode in config/application.rb and try again."
6
- end
7
- end
8
-
9
3
eager_load = -> ( ) do
10
4
puts "Hold on, I am eager loading the application."
11
5
Zeitwerk ::Loader . eager_load_all
You can’t perform that action at this time.
0 commit comments