just ram

stuff I should remember

vim-ruby-refactoring - Extract Constant

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

Extract Constant

Extracts a selection into a constant which is placed at the top of the current module or class.

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


Before refactoring:
Visually select the value you wish to extract
Hit your **** then type **rec **You will now see a prompt to enter the constant name: Constant name: Gravitational_Constant

After refactoring:
The value 9.81 has been extracted into a constant GRAVITATIONAL_CONSTANT which is placed at the top of the module.

rec is the default binding for this refactoring, think Refactor Extract Constant.