Wednesday, August 25, 2010

Where was that method or exemplar defined?

Do you ever want to know the source file for a particular method? You can use the class browser to jump to the code or you can do this...

MagikSF> circle.method(:new|()|).source_file
$

Most of the time, jumping to a method is faster in the Class Browser than using this code snippet.

But what if you want to jump to the file where the actual class exemplar (not the method) is defined? Then you can do this...

MagikSF> circle.method(:exemplar).source_file
$

I know of no way to do this latter action from the Class Browser.

1 comment:

Dariusz Michura said...

"I know of no way to do this latter action from the Class Browser. "

In MDT Class Browser you just click class name and voilĂ  :-)
But if you know class name it is faster to use Open Type dialog.