From: jweirich@... Date: 2000-11-14T09:02:19+09:00 Subject: [ruby-talk:6325] Class Browser Questions I did some more work on the GemFinder Class Browser I posted last week. I'm finding it a handy tool for exploring the Ruby class library. The latest release is now on RAA. Playing around with it has raised the following questions ... 1) What's the best way to convert from a class name string to a class object. I've been using Eval(class_name) and trapping any NameErrors. I could also search ObjectSpace looking for a match. Is there a better way? 2) I've been looking at singleton methods and noticed that for a class object c c.singleton_methods == c.methods - c.superclass.methods Will this always be true for class objects? 3) I would like to be able to tie classes and methods to source files. Currently, I don't see a direct way of doing this. The "Programming Ruby" book hints at using runtime callbacks to capture information about the system being defined. I'm thinking about wrapping "load" and "require" to record the file currently being loaded and then hook into class and method definitions to record that information. Does this sound reasonable? 4) What about reloading source files? I would like to be able to reload a source file to get the latest changes. I suspect that the naive approach might have problems. Can source files be arbitrarily reloaded? How can I detect deleted methods? -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)