convert to 1.9 hash syntax
I am trying to get used to the new Ruby 1.9 hash syntax (read more). Here’s a quick VIM replace command to convert all the 1.8 syntax to the new 1.9 syntax.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%s/\v\:([^\:][a-zA-Z0-9_]*)\s+\=\>/\1:/g |
I am quickly becoming a fan of this new style simply because it’s less characters to type and it looks more like JSON.
A similiar regex could be used in conjunction with sed to convert a whole project in one go.