Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Constantize a regexp in Dependencies#load_missing_constant

  • Loading branch information...
commit f17ea60f98f9049f2b0aaeeaf40ce9ad79ce824c 1 parent 89f3d8a
@jdelStrother jdelStrother authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  activesupport/lib/active_support/dependencies.rb
View
3  activesupport/lib/active_support/dependencies.rb
@@ -466,6 +466,7 @@ def qualified_name_for(mod, name)
# Load the constant named +const_name+ which is missing from +from_mod+. If
# it is not possible to load the constant into from_mod, try its parent module
# using const_missing.
+ THIS_FILE = %r{#{Regexp.escape(__FILE__)}}
def load_missing_constant(from_mod, const_name)
log_call from_mod, const_name
@@ -478,7 +479,7 @@ def load_missing_constant(from_mod, const_name)
qualified_name = qualified_name_for from_mod, const_name
path_suffix = qualified_name.underscore
- trace = caller.reject {|l| l =~ %r{#{Regexp.escape(__FILE__)}}}
+ trace = caller.reject {|l| l =~ THIS_FILE}
name_error = NameError.new("uninitialized constant #{qualified_name}")
name_error.set_backtrace(trace)
Please sign in to comment.
Something went wrong with that request. Please try again.