From: Luis Lavena Date: 2012-03-19T20:58:57+09:00 Subject: [ruby-core:43469] Re: [ruby-trunk - Feature #4523] Kernel#require to return the path of the loaded file On Mon, Mar 19, 2012 at 8:06 AM, Alex Young wrote: > On 18/03/12 10:22, nobu wrote: >> >> >> Issue #4523 has been updated by nobu. >> >> >> I don't think it's useful if it may return false. > > > On the contrary - if it returns false, you know the set of loaded files > hasn't changed. �You (should) know that no new ruby has been parsed. > What if your require triggers more requires inside? The usefulness of you collecting the response of one require doesn't mean you have all the files that were loaded. > >> What's the use case? >> I agree that the way to know the loaded path would be useful sometimes, >> but this doesn't seem nice. > > > The specific thing I was trying to do was gather all the required files into > a SQLite database. �Then a later process with an overridden `require` can > load *precisely* the same file content from that database, without > ambiguity. > Are you trying to build a list of all the files that were require'd ? If so, why not use $LOADED_FEATURES with at_exit? $LOADED_FEATURES include full paths so you can use that combined with $LOAD_PATH to determine the require itself. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup�ry