Determining what file contains a module/class

N

Nicholas Wieland

Hi *,
I need to find the file that contains a known module or class, to
"inspect" the source code and extract what I need from the file.
Something like:
'/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
 
A

Austin Ziegler

Hi *,
I need to find the file that contains a known module or class, to
"inspect" the source code and extract what I need from the file.
Something like:
=20
'/usr/local/lib/ruby/1.8/digest.rb'

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
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)
 
N

Nicholas Wieland

- Austin Ziegler :
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.

Well, I've used digest just to make an example, my question was more
general :=)
Actually I'm using something like:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,477
Latest member
ColumbusMa

Latest Threads

Top