>> require 'digest'
>> Digest::base_file
'/usr/local/lib/ruby/1.8/digest.rb'
I already had some suggestions on IRC that involve scanning through all
the files in the path with a regexp, and in fact it solves my problem,
but I think it's a bit overcomplicated, so I'd like to know if there's
some other way that avoids all that scanning.
TIA,
ngw
--
checking for life_signs in -lKenny... no
Oh my god, make (1) killed Kenny ! You, bastards !
nicholas_wieland-at-yahoo-dot-it
The problem in this case is that digest is specifically in digest.so,
not digest.rb. It also doesn't help if a module or class is defined
across multiple files, which is certainly permitted in Ruby.
-austin
--
Austin Ziegler * halos...@gmail.com
* Alternate: aus...@halostatue.ca
http://www.eng.cse.dmu.ac.uk/~hgs/ruby/RUBY_SNAPSHOT_RDOC/index.html
(Also not sure which 1.8 snapshot this is)
SCRIPT_LINES__ = {}
require 'net/ftp'
SCRIPT_LINES__.keys
that solves two problems in one.
TIA,
ngw
--
checking for life_signs in -lKenny... no
Oh my god, make (1) killed Kenny ! You, bastards !
nicholas_wieland-at-yahoo-dot-it
___________________________________
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica Scaricalo ora!
http://it.messenger.yahoo.it
If you wanted to do it like you initially wanted, you could
redefine require to get the filenames from SCRIPT_LINES__ (as
above) and get the new classes added from
ObjectSpace.each_object(Class). Based on that you could add
the base_file method. But, you'd only be able to detect when a
new class is added and not when it is being modified.
With that SCRIPT_LINES__ Hash, it doesn't look like you even
need to read the files since the file content is already in
SCRIPT_LINES__.
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/