Feature #5221
closedLoadEerror#path
Description
I read a part of activesupport and they add a method LoadError#path to return unloaded file name (*1).
*1: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/load_error.rb
How about to add this method on trunk?
This is a patch with some re-factoring around LoadError:
http://www.atdot.net/sp/view/y5xeql/readonly?lang=diff
Files
Updated by drbrain (Eric Hodel) over 13 years ago
RubyGems parses the exception message to determine the filename so having LoadError#path would make things easier.
Should we be able to raise a LoadError from ruby with #path set too?
Like:
raise LoadError.new("no such file -- #{path}", path)
Updated by tenderlovemaking (Aaron Patterson) over 13 years ago
On Wed, Aug 24, 2011 at 12:28:50PM +0900, Koichi Sasada wrote:
Issue #5221 has been reported by Koichi Sasada.
Feature #5221: LoadEerror#path
http://redmine.ruby-lang.org/issues/5221Author: Koichi Sasada
Status: Open
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
Target version: 1.9.4I read a part of activesupport and they add a method LoadError#path to return unloaded file name (*1).
*1: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/load_error.rb
How about to add this method on trunk?
This is a patch with some re-factoring around LoadError:
http://www.atdot.net/sp/view/y5xeql/readonly?lang=diff
Can we make it use a regular ivar for path
rather than an ivar with no
"@"? Using private ivars like this makes life hard for doing
introspection (like the introspection required for YAML to dump / load).
Like this: https://gist.github.com/1171267
--
Aaron Patterson
http://tenderlovemaking.com/
Updated by tenderlovemaking (Aaron Patterson) almost 13 years ago
Bump. Any news on this?
Updated by tenderlovemaking (Aaron Patterson) almost 13 years ago
I've updated the patch to include a test:
Updated by tenderlovemaking (Aaron Patterson) almost 13 years ago
- Target version changed from 1.9.4 to 2.0.0
Updated by tenderlovemaking (Aaron Patterson) almost 13 years ago
- File loaderror.patch loaderror.patch added
I've reduced the diff slightly. May I commit this?
Updated by ko1 (Koichi Sasada) almost 13 years ago
(2011/08/26 2:45), Aaron Patterson wrote:
Can we make it use a regular ivar for
path
rather than an ivar with no
"@"? Using private ivars like this makes life hard for doing
introspection (like the introspection required for YAML to dump / load).
I don't have any objection. Matz, what do you think about it?
--
// SASADA Koichi at atdot dot net
Updated by matz (Yukihiro Matsumoto) almost 13 years ago
I agree.
Updated by tenderlovemaking (Aaron Patterson) almost 13 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in r34938