From a599c034fd525d9adccc93b009a958e04d1dc333 Mon Sep 17 00:00:00 2001 From: Mitsutaka Mimura Date: Tue, 12 Jun 2012 17:37:56 +0900 Subject: [PATCH] fix method redefined warning in Ruby2.0 Ruby2.0 already has LoadError#path. --- .../lib/active_support/core_ext/load_error.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/load_error.rb b/activesupport/lib/active_support/core_ext/load_error.rb index 8bdfa0c5bcd77..fe24f3716d4c1 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