# Ruby auto formatter

**URL:** <https://www.ruby-forum.com/t/ruby-auto-formatter/57525>\
**Category:** Ruby\
**Created:** [April 11, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/ruby-auto-formatter/57525 "2006-04-11T18:45:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamal86](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@jamal86](https://www.ruby-forum.com/u/jamal86)\
**Post date:** [April 11, 2006, 6:45pm UTC](https://www.ruby-forum.com/t/ruby-auto-formatter/57525/1 "2006-04-11T18:45:31Z")

</div>

Is there a Windows tool that does a reasonable job of globally  
formatting an existing Ruby script file so that it complies with the  
convention for code indentation?

Jamal

---

<div class="post-metadata">

**Author:** ![jamal86](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@jamal86](https://www.ruby-forum.com/u/jamal86)\
**Post date:** [April 11, 2006, 7:19pm UTC](https://www.ruby-forum.com/t/ruby-auto-formatter/57525/2 "2006-04-11T19:19:17Z")

</div>

Jamal M. wrote:

> Is there a Windows tool that does a reasonable job of globally  
> formatting an existing Ruby script file so that it complies with the  
> convention for code indentation?
> 
> Jamal

have not tried it but,

> **[\* Ruby Script Beautifier](https://arachnoid.com/ruby/rubyBeautifier.html)**
>
> A beautifier for Ruby source files ... written in Ruby.

---

<div class="post-metadata">

**Author:** ![jamal86](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@jamal86](https://www.ruby-forum.com/u/jamal86)\
**Post date:** [April 12, 2006, 2:19am UTC](https://www.ruby-forum.com/t/ruby-auto-formatter/57525/3 "2006-04-12T02:19:13Z")

</div>

DÅ?a Utorok 11. AprÃ­l 2006 18:42 Jamal M. napÃ­sal:

> Is there a Windows tool that does a reasonable job of globally  
> formatting an existing Ruby script file so that it complies with the  
> convention for code indentation?
> 
> Jamal

You can get one of the emacsen to load the file and reindent it in batch  
mode,  
ruby-mode does a pretty god job at that - I know I got someone to give  
me the  
whole command line a while ago, but lost the message since, try  
searching the  
forums for it.

David V.

---

<div class="post-metadata">

**Author:** ![jamal86](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@jamal86](https://www.ruby-forum.com/u/jamal86)\
**Post date:** [April 12, 2006, 10:32pm UTC](https://www.ruby-forum.com/t/ruby-auto-formatter/57525/4 "2006-04-12T22:32:41Z")

</div>

David V. wrote:

> DÅ?a Utorok 11. AprÃ­l 2006 18:42 Jamal M. napÃ­sal:
> 
> > Is there a Windows tool that does a reasonable job of globally  
> > formatting an existing Ruby script file so that it complies with the  
> > convention for code indentation?
> > 
> > Jamal
> 
> You can get one of the emacsen to load the file and reindent it in batch  
> mode,  
> ruby-mode does a pretty god job at that - I know I got someone to give  
> me the  
> whole command line a while ago, but lost the message since, try  
> searching the  
> forums for it.

Not that you would want to do this with large quantities, but FWIW, I  
thought I’d mention:

$ diakonos -e ‘anchorSelection; cursorEOF; parsedIndent; saveFile; quit’  
my\_file\_which\_needs\_auto\_indenting.rb

Pistos
