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

Extract constant

Last modified: 26 January 2023

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

To extract a constant: