Home > Ruby, vim > vim-ruby-refactoring – Extract to Let

vim-ruby-refactoring – Extract to Let

30 December, 2010

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

Extract to Let

This is an RSpec specific refactoring which will extract an initialisation line and create a let method for you.

Example

Before refactoring:
ExtractLet_Before 
Move the cursor on to the line you wish to extract
Hit your <leader-key> then type rel

After refactoring:
ExtractLet_After
The let method is created above the it block, using the initialisation line – account = Account.new.

rel is the default binding for this refactoring, think Refactor Extract Let.

Advertisements
  1. No comments yet.
  1. 30 December, 2010 at 11:55 pm
Comments are closed.
%d bloggers like this: