From abe70e8ba18979a4519849f5276a82260f2a4cc4 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Wed, 2 Nov 2016 11:39:46 +0000 Subject: Ruby 2.0 added LoadError#path --- activesupport/lib/active_support/core_ext/load_error.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/load_error.rb b/activesupport/lib/active_support/core_ext/load_error.rb index 8bdfa0c5bc..bc575ee176 100644 --- a/activesupport/lib/active_support/core_ext/load_error.rb +++ b/activesupport/lib/active_support/core_ext/load_error.rb @@ -6,12 +6,14 @@ class LoadError /^cannot load such file -- (.+)$/i, ] - def path - @path ||= begin - REGEXPS.find do |regex| - message =~ regex + unless method_defined?(:path) + def path + @path ||= begin + REGEXPS.find do |regex| + message =~ regex + end + $1 end - $1 end end @@ -20,4 +22,4 @@ class LoadError end end -MissingSourceFile = LoadError \ No newline at end of file +MissingSourceFile = LoadError -- cgit v1.2.3