RubyMine 2018.3 Help

Refactoring Source Code

Refactoring is the process of modifying source code in order to make it easier to maintain and extend, but without changing its behavior. RubyMine supports various refactoring operations for different programming languages. This topic mostly covers refactorings available for Ruby.

Invoke refactoring

  1. Select an item to refactor. You can select a file/folder in the Project tool window or expression/symbol in the editor.

  2. Press Ctrl+Shift+Alt+T to open a pop-up list of refactorings that can be selected.

    refactor this popup
    Alternatively, you can use a keyboard shortcut for a specific refactoring.

If you need to undo your refactoring, press Ctrl+Z.

Configure refactoring settings

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Editor | General.

  2. On the General page, in the Refactorings section, adjust the refactoring options and click OK.

Refactorings supported in RubyMine

Rename Refactorings

Refactor | Rename

Shift+F6

Move and Copy Refactorings

Refactor | Move
Refactor | Copy

F6
F5

Extract Variable

Refactor | Extract | Variable

Ctrl+Alt+V

Extract Constant

Refactor | Extract | Constant

Ctrl+Alt+C

Extract Field

Refactor | Extract | Field

Ctrl+Alt+F

Extract Parameter

Refactor | Extract | Parameter

Ctrl+Alt+P

Extract Method

Refactor | Extract | Method

Ctrl+Alt+M

Extract Superclass

Refactor | Extract | Superclass

Extract Module

Refactor | Extract | Module

Inline

Refactor | Inline

Ctrl+Alt+N

Pull Members Up, Push Members Down

Refactor | Pull Members Up
Refactor | Push Members Down

Safe Delete

Refactor | Safe Delete

Alt+Delete

Extract Partial

Refactor | Extract | Partial

Extract Include File

Refactor | Extract | Extract Include File

Last modified: 6 December 2018

See Also