aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJonathan del Strother <jon.delStrother@audioboo.fm>2011-07-26 16:10:55 +0100
committerJonathan del Strother <jon.delStrother@audioboo.fm>2011-07-26 16:10:55 +0100
commitf17ea60f98f9049f2b0aaeeaf40ce9ad79ce824c (patch)
tree04fba25029833fb305f9be492c2d4db685febdf3 /activesupport
parent89f3d8a886ee6d678b60b5e5df4d3a11d93c53d4 (diff)
downloadrails-f17ea60f98f9049f2b0aaeeaf40ce9ad79ce824c.tar.gz
rails-f17ea60f98f9049f2b0aaeeaf40ce9ad79ce824c.tar.bz2
rails-f17ea60f98f9049f2b0aaeeaf40ce9ad79ce824c.zip
Constantize a regexp in Dependencies#load_missing_constant
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/dependencies.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index d1543c4c58..a60697cb12 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -466,6 +466,7 @@ module ActiveSupport #:nodoc:
# 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 @@ module ActiveSupport #:nodoc:
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)