RubyMine 2017.2 Help

Part 2. Navigating to a Declaration, Implementation and Test

Navigating to declaration

Place the caret at the method feeds of the instance of the class Cat, and press Ctrl+B. RubyMine jumps to the declaration of the method feeds, which is declared in the class Mammalia:

/help/img/idea/2017.2/rm_goto_declaration.png

Navigating to implementation

Now, place caret at the declaration of the class Mammalia and try to find out which other classes implement it. To do that, press Ctrl+Alt+B. You see a rather long list of classes implementing Mammalia:

/help/img/idea/2017.2/rm_goto_implementation.png

Ok, choose whichever implementation you need (for example, Tiger), and press Enter. RubyMine navigates to the selected implementation and places the caret at the class Tiger declaration:

/help/img/idea/2017.2/rm_goto_implementation_1.png

Should you select, for example Carnivorae, which resides in a separate file, this file would open in a separate editor tab.

Side note about pin

Presumably, you have already noticed the pin icon /help/img/idea/2017.2/pin_small.png in the upper-right corner of the pop-up window. The same icon appears, for example, in the quick documentation lookup (Ctrl+Q). If you click this pin, the whole pop-up window will be "pinned", which in the case of navigation and search means that all the encountered occurrences will be presented in the Find tool window.

Navigating with gutter icons

Now, let's look at the left gutter. You see there a number of icons with the arrows pointing up or down. What does it mean?

If you hover your mouse pointer over an icon, RubyMine will show the list of child classes or overriding methods (in case of the down arrow), or the parent classes (in case of the up arrow):

/help/img/idea/2017.2/rm_implementation_declaration.png

What happens, if you click an icon? If a certain class is subclassed, or a method is overridden in more than one class, RubyMine will suggest to select the desired target from the list:

/help/img/idea/2017.2/rm_declaration_implementation_1.png

After that, RubyMine jumps to the selected target, and places the caret at the class (method) declaration. If there is only one superclass/subclass, or method, then such a navigation is done silently.

Summary

This brief tutorial is over. You've mastered the following features:

  • Navigating to a declaration.
  • Navigating to an implementation.
  • Using the gutter icons /help/img/idea/2017.2/gutterIconOverridden.gif or /help/img/idea/2017.2/gutterIconOverriding.png to jump to an implementation or declaration.
  • Creating a test and jumping to it.

What's next?

Let's proceed with Part 3 and see how to find usages of a class or symbol.

See Also

Last modified: 21 July 2017