Home > Ruby, vim > vim-ruby-refactoring – Inline Temp

vim-ruby-refactoring – Inline Temp

30 December, 2010

This post is part of a series which documents the vim-ruby-refactoring plugin.

Inline Temp

Replaces a temporary variable with a direct call to the method or formula.

The refactoring: http://www.refactoring.com/catalog/inlineTemp.html

Example

Before refactoring:

InlineTemp_Before
Move the cursor onto the temp variable (in this case base_price)
Hit your <leader-key> then type rit

After refactoring:

InlineTemp_After
The temp variable base_price has been replace with a direct call to the method and we’ve saved a line of code.

rit is the default binding for this refactoring, think Refactor Inline Temp.

About these ads
  1. No comments yet.
Comments are closed.
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: