aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/dependencies/zeitwerk_integration.rb')
-rw-r--r--activesupport/lib/active_support/dependencies/zeitwerk_integration.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
index f75083a05a..2cf55713bd 100644
--- a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
+++ b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
@@ -42,6 +42,17 @@ module ActiveSupport
end
end
+ module RequireDependency
+ def require_dependency(filename)
+ filename = filename.to_path if filename.respond_to?(:to_path)
+ if abspath = ActiveSupport::Dependencies.search_for_file(filename)
+ require abspath
+ else
+ require filename
+ end
+ end
+ end
+
module Inflector
def self.camelize(basename, _abspath)
basename.camelize
@@ -90,7 +101,7 @@ module ActiveSupport
def decorate_dependencies
Dependencies.unhook!
Dependencies.singleton_class.prepend(Decorations)
- Object.class_eval { alias_method :require_dependency, :require }
+ Object.prepend(RequireDependency)
end
end
end