Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Replace unnecessary regexp in Dependencies#load_missing_constant #2291

merged 1 commit into from

2 participants

Jonathan del Strother Aaron Patterson
Jonathan del Strother

Tenderlove persuaded me to tweak my last patch a little, to remove the unnecessary regexp. It's a bit cleaner, and might be a shade faster.

Aaron Patterson tenderlove merged commit e4a7b23 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 2 deletions.
  1. +1 −2  activesupport/lib/active_support/dependencies.rb
3  activesupport/lib/active_support/dependencies.rb
@@ -466,7 +466,6 @@ 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
@@ -479,7 +478,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 =~ THIS_FILE}
+ trace = caller.reject {|l| l.starts_with? __FILE__ }
name_error ="uninitialized constant #{qualified_name}")
Something went wrong with that request. Please try again.