开发者

How do I reformat ruby code from the command line?

开发者 https://www.devze.com 2023-03-06 09:56 出处:网络
Given a so开发者_JS百科urce file with bad indentation, incorrect white space management, and so on. How do I reformat the code such a file and apply the Ruby\'s style guide (if present)?This should be

Given a so开发者_JS百科urce file with bad indentation, incorrect white space management, and so on. How do I reformat the code such a file and apply the Ruby's style guide (if present)?


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

A Ruby script that does it is available at: http://www.arachnoid.com/ruby/rbeautify.rb.html


Haven't tried it myself:

http://www.arachnoid.com/ruby/rubyBeautifier.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号