aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2019-01-27 18:30:57 +0100
committerXavier Noria <fxn@hashref.com>2019-01-27 18:41:38 +0100
commitaadeed1518b9092ea21adf49c728172368129f0e (patch)
tree4c8bf700e2da109103bb2529941fe127705460be /railties/lib/rails
parentde0c705516cf8f15f70b47e35e4117bb9d4d537c (diff)
downloadrails-aadeed1518b9092ea21adf49c728172368129f0e.tar.gz
rails-aadeed1518b9092ea21adf49c728172368129f0e.tar.bz2
rails-aadeed1518b9092ea21adf49c728172368129f0e.zip
Simplify path prefix extraction
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/engine.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index f768c30db0..6695507d93 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -473,9 +473,10 @@ module Rails
# files inside eager_load paths.
def eager_load!
config.eager_load_paths.each do |load_path|
- matcher = /\A#{Regexp.escape(load_path.to_s)}\/(.*)\.rb\Z/
+ # Starts after load_path plus a slash, ends before ".rb".
+ relname_range = (load_path.length + 1)...-3
Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
- require_dependency file.sub(matcher, '\1')
+ require_dependency file[relname_range]
end
end
end