RubyMine
 
Get RubyMine
You are viewing the documentation for an earlier version of RubyMine.

Extract constant

Last modified: 09 August 2022

Refactor | Extract/Introduce | Constant

Ctrl+Alt+C

As Extract Variable, the Extract Constant refactoring lets you extract a specified value to a corresponding constant.

The animation below demonstrates how to extract a specific word from a string to a constant:

https://resources.jetbrains.com/help/img/idea/2022.2/rm_refactoring_extract_constant.png
Gif

To extract a constant: