Pull members up, push members down
Last modified: 10 May 2022
The Pull Members Up refactoring allows you to move class members to a specified superclass. Push Members Down moves class members to a subclass.
Pull members up
To pull members up:
Place a caret at the class name or any place within a class:
From the main menu, choose Refactor | Pull Members Up....
In the invoked dialog, select the desired members and the superclass where these members will be placed:
Click OK.
Before | After |
---|---|
cat.rb file
| animal.rb file
cat.rb file
|
Push members down
To push members down:
Place a caret at the class name or any place within a class.
From the main menu, choose Refactor | Push Members Down....
In the invoked dialog, select the desired members that will be moved to a subclass:
Click OK.
Before | After |
---|---|
animal.rb file
mammal.rb file
| animal.rb file
mammal.rb file
|