Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert ruby source code from old style to new style hash

Tags:

ruby

Anybody knows a converter which takes a list of ruby source files and reliably replaces all old style (hash-rocket) hashes to new style (ruby 1.9) hash syntax? :)

like image 985
gucki Avatar asked Nov 27 '11 18:11

gucki


Video Answer


1 Answers

Rubocop is a static code analyzer that evaluates your code against many of the recommendations of the Ruby Style Guide. It has an --auto-correct option that can automatically change your code to what is recommended. One of those auto-correct options is for hash syntax.

Example:

rubocop --only HashSyntax --auto-correct

will only correct your hashes.

like image 114
Andrew Grimm Avatar answered Sep 18 '22 20:09

Andrew Grimm