diff options
author | Mitsutaka Mimura <takkanm@gmail.com> | 2012-06-12 17:37:56 +0900 |
---|---|---|
committer | Mitsutaka Mimura <takkanm@gmail.com> | 2012-06-12 17:41:53 +0900 |
commit | a599c034fd525d9adccc93b009a958e04d1dc333 (patch) | |
tree | e3ad43c2e63af1354207e230c9acb2e0d72c00cb /activesupport/lib | |
parent | e6ea3fec305db2872827aedd95a77d343079b8f5 (diff) | |
download | rails-a599c034fd525d9adccc93b009a958e04d1dc333.tar.gz rails-a599c034fd525d9adccc93b009a958e04d1dc333.tar.bz2 rails-a599c034fd525d9adccc93b009a958e04d1dc333.zip |
fix method redefined warning in Ruby2.0
Ruby2.0 already has LoadError#path.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/load_error.rb | 12 |
1 files 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 8bdfa0c5bc..fe24f3716d 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 |