How to reformat ruby ​​code from command line?

Given a source file with bad indentation, incorrect space management, etc. How to reformat the code of such a file and apply the Ruby style guide (if any)?

+6
source share
2 answers

This should be the task of your editor. In vim (configured for Ruby) just hit gg=G xD

A Ruby script, which is available at: http://www.arachnoid.com/ruby/rbeautify.rb.html

+3
source
+2
source

Source: https://habr.com/ru/post/888362/


All Articles