Skip to content

Loading…

fix method redefined warning in Ruby2.0 #6711

Merged
merged 1 commit into from

2 participants

@takkanm

I found following warning in Ruby2.0.0dev(2012-06-12 trunk 36037).

activesuport/lib/active_support/core_ext/load_error.rb:9: warning: method redefined; discarding old path

Ruby2.0 already has LoadError#path.

see http://bugs.ruby-lang.org/issues/show/5221

@takkanm takkanm fix method redefined warning in Ruby2.0
Ruby2.0 already has LoadError#path.
a599c03
@josevalim josevalim merged commit 122f6de into rails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 12, 2012
  1. @takkanm

    fix method redefined warning in Ruby2.0

    takkanm committed
    Ruby2.0 already has LoadError#path.
Showing with 7 additions and 5 deletions.
  1. +7 −5 activesupport/lib/active_support/core_ext/load_error.rb
View
12 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
Something went wrong with that request. Please try again.