# インライン化​

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

> **TL;DR**
> `リファクタリング | インライン化`
>
>
>
> `Ctrl+Alt+N` (Windows), `⌘ ⌥ N` (macOS), `⌘ ⌥ N` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ N` (macOS System Shortcuts), `Ctrl+Alt+N` (XWin), `Ctrl+Alt+N` (GNOME), `Ctrl+Alt+N` (KDE), `Ctrl+Alt+N` (Emacs), `Ctrl+Alt+N` (Sublime Text), `⌘ ⌥ N` (Sublime Text (macOS)), `Ctrl+R, I` (Visual Studio), `⌘ R, I` (Visual Studio (macOS)), `Meta+Alt+N` (TextMate), `Ctrl+Alt+N` (NetBeans), `Alt+Shift+I` (Eclipse), `⌘ ⌥ I` (Eclipse (macOS))

現在、RubyMine では、  関数のインライン化 リファクタリングが提供されており、これは [メソッドの抽出​](extract-method.html)リファクタリングとは反対です。

インライン化 リファクタリングでは、変数とメソッドの抽出リファクタリングを元に戻すことができます。

以下のアニメーションは、変数を文字列にインライン化する方法を示しています。

![inline variable](https://resources.jetbrains.com/help/img/idea/2026.3/rm_refactoring_inline_variable.animated.gif)

変数 / メソッドをインライン化するには:

Procedure:

1. 変数 / メソッド名にキャレットを置きます。

2. `Ctrl+Alt+N` (Windows), `⌘ ⌥ N` (macOS), `⌘ ⌥ N` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ N` (macOS System Shortcuts), `Ctrl+Alt+N` (XWin), `Ctrl+Alt+N` (GNOME), `Ctrl+Alt+N` (KDE), `Ctrl+Alt+N` (Emacs), `Ctrl+Alt+N` (Sublime Text), `⌘ ⌥ N` (Sublime Text (macOS)), `Ctrl+R, I` (Visual Studio), `⌘ R, I` (Visual Studio (macOS)), `Meta+Alt+N` (TextMate), `Ctrl+Alt+N` (NetBeans), `Alt+Shift+I` (Eclipse), `⌘ ⌥ I` (Eclipse (macOS)) を押すか、メインメニューで  `リファクタリング | インライン化`  に移動します。

3. 選択した変数またはメソッドに対応する   インライン化​   ダイアログで、インライン化オプションを指定します。 プレビューと変更の適用

## 変数のインライン化

変数のインライン化 リファクタリングは、冗長な変数の使用をイニシャライザーで置き換えます。 このリファクタリングは [変数の導入](extract-variable.html)の反対です。

|  前  |  後  |
| --- | --- |
|     ```RUBY name = "JetBrains" puts "Hello from #{name}"  ```    |     ```RUBY puts "Hello from JetBrains"  ```    |

## メソッドのインライン化

メソッドのインライン化 は、メソッドの本体を呼び出し元の本体に配置します。

|  前  |  後  |
| --- | --- |
|     ```RUBY def test   c=add(a,b)   d=add(a,c) end  def add(a, b)   a+b end  ```    |     ```RUBY def test   c = a + b   d = a + c end  ```    |

## See also

### プロシージャ

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

### プロシージャ

[変数の抽出 / 導入](extract-variable.html) [Extracting variables in Style Sheets](null)

### 外部リンク

[Inline method](http://blog.jetbrains.com/ruby/2012/01/whats-mining-inline-method-refactoring/)

