From: "trans (Thomas Sawyer)" <transfire@...>
Date: 2012-03-19T02:09:10+09:00
Subject: [ruby-core:43456] [ruby-trunk - Feature #4523] Kernel#require to return the path of the loaded file


Issue #4523 has been updated by trans (Thomas Sawyer).


I haven't worked on the project where such comes into play in a few months, so I can only recollect the obvious usecase at the moment -- When debugging a problem were you suspect the wrong file is being required. Then this could be very helpful. For instance I was recently having issues working on Test::Unit, running into cases were MiniTest's emulation lib was being loaded rather than from the gem. If I could have just put a `p` in front of the `require 'test/unit'` that would made it a quick check.
 

----------------------------------------
Feature #4523: Kernel#require to return the path of the loaded file
https://bugs.ruby-lang.org/issues/4523#change-24924

Author: regularfry (Alex Young)
Status: Feedback
Priority: Normal
Assignee: 
Category: 
Target version: 


=begin
It's very useful to be able to tell which actual file on disc was loaded following a call to require, without having to manually traverse $LOAD_PATH. This information is also not guaranteed to be in $LOADED_FEATURES.

The attached patch alters rb_require_safe's return value to indicate the loaded file iff a file is actually loaded.
=end



-- 
http://bugs.ruby-lang.org/