Skip to content
This repository
Browse code

Merge pull request #2291 from jdelStrother/load_missing_constant

Replace unnecessary regexp in Dependencies#load_missing_constant
  • Loading branch information...
commit e4a7b23d382d9cf66771c0ce3eefe35c08e3711a 2 parents 6089ecf + 43ef635
Aaron Patterson authored
3  activesupport/lib/active_support/dependencies.rb
@@ -466,7 +466,6 @@ def qualified_name_for(mod, name)
466 466
     # Load the constant named +const_name+ which is missing from +from_mod+. If
467 467
     # it is not possible to load the constant into from_mod, try its parent module
468 468
     # using const_missing.
469  
-    THIS_FILE = %r{#{Regexp.escape(__FILE__)}}
470 469
     def load_missing_constant(from_mod, const_name)
471 470
       log_call from_mod, const_name
472 471
 
@@ -479,7 +478,7 @@ def load_missing_constant(from_mod, const_name)
479 478
       qualified_name = qualified_name_for from_mod, const_name
480 479
       path_suffix = qualified_name.underscore
481 480
 
482  
-      trace = caller.reject {|l| l =~ THIS_FILE}
  481
+      trace = caller.reject {|l| l.starts_with? __FILE__ }
483 482
       name_error = NameError.new("uninitialized constant #{qualified_name}")
484 483
       name_error.set_backtrace(trace)
485 484
 

0 notes on commit e4a7b23

Please sign in to comment.
Something went wrong with that request. Please try again.