aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/dependencies.rb
diff options
context:
space:
mode:
authorBart de Water <bartdewater@gmail.com>2018-07-28 18:36:51 -0400
committerBart de Water <bartdewater@gmail.com>2018-07-28 18:56:17 -0400
commitff9bdc2744525bd97a481c08984cb5c21768cf52 (patch)
treea23b10dde00ffb3b6438d12e89b5aaa88cc88cd4 /activesupport/lib/active_support/dependencies.rb
parenteb5fea40a404e829f00552859ae1b206728d99d7 (diff)
downloadrails-ff9bdc2744525bd97a481c08984cb5c21768cf52.tar.gz
rails-ff9bdc2744525bd97a481c08984cb5c21768cf52.tar.bz2
rails-ff9bdc2744525bd97a481c08984cb5c21768cf52.zip
Work around Performance/EndWith false positive
Rubocop warns about "Use String#end_with? instead of a regex match anchored to the end of the string", it doesn't seem aware of the $` special variable like Performance/RegexpMatch
Diffstat (limited to 'activesupport/lib/active_support/dependencies.rb')
-rw-r--r--activesupport/lib/active_support/dependencies.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index a02cefc78e..46a31a9016 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -345,7 +345,7 @@ module ActiveSupport #:nodoc:
end
def require_or_load(file_name, const_path = nil)
- file_name = $` if file_name =~ /\.rb\z/
+ file_name = file_name.chomp(".rb") if file_name.end_with?(".rb")
expanded = File.expand_path(file_name)
return if loaded.include?(expanded)
@@ -395,7 +395,7 @@ module ActiveSupport #:nodoc:
# constant paths which would cause Dependencies to attempt to load this
# file.
def loadable_constants_for_path(path, bases = autoload_paths)
- path = $` if path =~ /\.rb\z/
+ path = path.chomp(".rb") if path.end_with?(".rb")
expanded_path = File.expand_path(path)
paths = []