RubyMine
 
Get RubyMine

Extract constant

Last modified: 08 October 2024

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/2024.3/rm_refactoring_extract_constant.png
Gif

To extract a constant: