Feature #5221
closedLoadEerror#path
Added by ko1 (Koichi Sasada) about 14 years ago. Updated over 13 years ago.
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
noname (500 Bytes) noname | tenderlovemaking (Aaron Patterson), 08/26/2011 02:53 AM | ||
loaderror.patch (3.99 KB) loaderror.patch | tenderlovemaking (Aaron Patterson), 02/25/2012 04:39 AM |
Updated by drbrain (Eric Hodel) about 14 years ago
Actions
#1
[ruby-core:39088]
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) about 14 years ago
Actions
#2
[ruby-core:39112]
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) over 13 years ago
Actions
#3
[ruby-core:42709]
Bump. Any news on this?
Updated by tenderlovemaking (Aaron Patterson) over 13 years ago
Actions
#4
[ruby-core:42719]
I've updated the patch to include a test:
Updated by tenderlovemaking (Aaron Patterson) over 13 years ago
Actions
#5
[ruby-core:42720]
- Target version changed from 1.9.4 to 2.0.0
Updated by tenderlovemaking (Aaron Patterson) over 13 years ago
Actions
#6
[ruby-core:42866]
- File loaderror.patch loaderror.patch added
I've reduced the diff slightly. May I commit this?
Updated by ko1 (Koichi Sasada) over 13 years ago
Actions
#7
[ruby-core:42868]
(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) over 13 years ago
Actions
#8
[ruby-core:43103]
I agree.
Updated by tenderlovemaking (Aaron Patterson) over 13 years ago
Actions
#9
[ruby-core:43106]
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in r34938