RubyMine 2018.3 Help

Pull Members Up, Push Members Down

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:

  1. Place a caret at the class name or any place within a class:

  2. From the main menu, choose Refactor | Pull Members Up....

  3. In the invoked dialog, select the desired members and the superclass where these members will be placed:

    Pull Members Up dialog

    Click OK.

Before

After

cat.rb file

class Cat < Mammal def move puts "move" end def speak puts "Meow" end end

animal.rb file

class Animal def move puts "move" end end
cat.rb file
class Cat < Mammal def speak puts "Meow" end end

Push Members Down

To push members down:

  1. Place a caret at the class name or any place within a class.

  2. From the main menu, choose Refactor | Push Members Down....

  3. In the invoked dialog, select the desired members that will be moved to a subclass:

    Push Members Down dialog

Click OK.

Before

After

animal.rb file

class Animal def breathe puts "inhale and exhale" end def move puts "move" end end
mammal.rb file
class Mammal < Animal end

animal.rb file

class Animal def move puts "move" end end
mammal.rb file
class Mammal < Animal def breathe puts "inhale and exhale" end end

Last modified: 6 December 2018

See Also