To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratorInline Temp :RInlineTemp
This refactoring takes a temporary variable and inlines the use of it.
Shortcuts:
:RInlineTemp
- Scenarios
-
- Inline a temporary variable
- Inline a temporary variable to two variables on the same line
- Inline a temporary variable to all variables within the context of a method
- Inline a temporary variable to all variables within the context of a method
- Inline a temporary variable to all variables within the context of a method
- Inline a temporary variable
-
- Given
-
I have the following code:
foo = 10 puts foo
- When
-
I go to the line and execute:
:RInlineTemp
- Then
-
I should see:
puts 10
- Inline a temporary variable to two variables on the same line
-
- Given
-
I have the following code:
x = 5 y = x and z = x
- When
-
I go to the line and execute:
:RInlineTemp
- Then
-
I should see:
y = 5 and z = 5
- Inline a temporary variable to all variables within the context of a method
-
- Given
-
I have the following code:
def some_method x = 5 y = x and z = x r = x + 2 end def some_other_method x = 2 y = x + 1 end
- When
-
I go to line "2" and execute:
:RInlineTemp
- Then
-
I should see:
def some_method y = 5 and z = 5 r = 5 + 2 end def some_other_method x = 2 y = x + 1 end
- Inline a temporary variable to all variables within the context of a method
-
- Given
-
I have the following code:
x = 5 foo = x + 10 x = 10 bar = x + 10
- When
-
I go to the line and execute:
:RInlineTemp
- Then
-
I should see:
foo = 5 + 10 x = 10 bar = x + 10
- Inline a temporary variable to all variables within the context of a method
-
- Given
-
I have the following code:
a = 1 b = a + 1 a = 2 c = a + 1
- When
-
I go to line "3" and execute:
:RInlineTemp
- Then
-
I should see:
a = 1 b = a + 1 c = 2 + 1
Last published over 5 years ago by despo.