RubyMine 2022.2 Help

Inline

    The Inline refactoring lets you reverse the extract refactoring for variables and methods.

    The animation below demonstrates how to inline a variable to a string:

    inline variable

    To inline a variable/method:

    1. Place a caret at the variable/method name.

    2. Press Ctrl+Alt+N or from the main menu, select Refactor | Inline.

    3. In the Inline dialog that corresponds to the selected variable or method, specify the inlining options. Preview and apply changes.

    Inline Variable

    The Inline Variable refactoring replaces redundant variable usage with its initializer. This refactoring is opposite to Extract Variable.

    Before

    After

    name = "JetBrains" puts "Hello from #{name}"
    puts "Hello from JetBrains"

    Inline Method

    Inline Method results in placing method's body into the body of its caller(s).

    Before

    After

    def test c=add(a,b) d=add(a,c) end def add(a, b) a+b end
    def test c = a + b d = a + c end
    Last modified: 09 August 2022