Indent.rb <- does such a beast exist?

Does anybody have a standalone Ruby app and/or library that will properly indent a chunk of Ruby code? I'm looking for something that does the equivalent of "indent-region" in ruby-mode for Emacs.

I know something like this exists in a few libraries -- I've heard talk about it from the ParseTree / RubyToC folks. I just wonder if anybody has packaged one up as a standalone app and/or library.

I think it would be really useful to fix formatting issues if you don't have emacs handy. It could also be something you point newbies too who are copying and pasting code from websites and emails, which may or may not keep the formatting properly preserved. The added smugness factor is that you could never do it with Python. :wink:

Ben

Ben Giddings wrote:

Does anybody have a standalone Ruby app and/or library that will properly indent a chunk of Ruby code? I'm looking for something that does the equivalent of "indent-region" in ruby-mode for Emacs.

I know something like this exists in a few libraries -- I've heard talk about it from the ParseTree / RubyToC folks. I just wonder if anybody has packaged one up as a standalone app and/or library.

This is not a ruby solution, but vim will reformat ruby code if emacs isn't handy.

vim -c "normal ggVG=" test.rb

-ryan

Ben Giddings wrote:

Does anybody have a standalone Ruby app and/or library that will properly indent a chunk of Ruby code? I'm looking for something that does the equivalent of "indent-region" in ruby-mode for Emacs.

I know something like this exists in a few libraries -- I've heard talk about it from the ParseTree / RubyToC folks. I just wonder if anybody has packaged one up as a standalone app and/or library.

This is not a ruby solution, but vim will reformat ruby code if emacs
isn't handy.

vim -c "normal ggVG=" test.rb

-ryan

* Ben Giddings (Mar 04, 2005 18:20):

Does anybody have a standalone Ruby app and/or library that will
properly indent a chunk of Ruby code? I'm looking for something that
does the equivalent of "indent-region" in ruby-mode for Emacs.

I'm going to write a indent.rb one of these days. I've had some
experience in this area, as I wrote indent/ruby.vim for Vim, but haven't
gotten around to writing a stand-alone application just yet...,
  nikolai

ยทยทยท

--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}