# メンバーのプルアップ、メンバーのプッシュダウン

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/ja-jp/help/ruby/llms.txt).

メンバーのプルアップ リファクタリングを使用すると、クラスメンバーを指定したスーパークラスに移動できます。  メンバーのプッシュダウン はクラスメンバーをサブクラスに移動します。

## メンバーのプルアップ​

メンバーをプルアップするには:

Procedure:

1. クラス名またはクラス内の任意の場所にキャレットを置きます。

![place the caret](https://resources.jetbrains.com/help/img/idea/2026.3/rm_refactoring_pull_up_caret.animated.gif)

2. `リファクタリング | メンバーのプルアップ ...`  に進みます。

3. 呼び出されたダイアログで、目的のメンバーとこれらのメンバーが配置されるスーパークラスを選択します。

![メンバーのプルアップダイアログ](https://resources.jetbrains.com/help/img/idea/2026.3/rm_refactoring_pull_up_dialog.png)

OK   をクリックしてください。

|  前  |  後  |
| --- | --- |
|    cat.rb   ファイル    ```RUBY class Cat < Mammal   def move     puts "move"   end   def speak     puts "Meow"   end end  ```    |    animal.rb   ファイル    ```RUBY class Animal def move puts "move" end end  ```     cat.rb   ファイル    ```RUBY class Cat < Mammal   def speak     puts "Meow"   end end  ```    |

## メンバーのプッシュダウン

メンバーをプッシュダウンするには:

Procedure:

1. クラス名またはクラス内の任意の場所にキャレットを置きます。

2. メインメニューで  `リファクタリング | メンバーのプッシュダウン ...`  へ移動します。

3. 呼び出されたダイアログで、サブクラスに移動するメンバーを選択してください。

![メンバーのプッシュダウンダイアログ](https://resources.jetbrains.com/help/img/idea/2026.3/rm_refactoring_push_down_dialog.png)

OK   をクリックしてください。

|  前  |  後  |
| --- | --- |
|    animal.rb   ファイル    ```RUBY class Animal def breathe puts "inhale and exhale" end def move puts "move" end end  ```     mammal.rb   ファイル    ```RUBY class Mammal < Animal end  ```    |    animal.rb   ファイル    ```RUBY class Animal def move puts "move" end end  ```     mammal.rb   ファイル    ```RUBY class Mammal < Animal   def breathe     puts "inhale and exhale"   end end  ```    |

## See also

### プロシージャ

[コードのリファクタリング](refactoring-source-code.html)

