[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

indent.rb <- does such a beast exist?

Ben Giddings

3/4/2005 5:16:00 PM

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. ;)

Ben


4 Answers

Ryan Phillips

3/4/2005 9:27:00 PM

0

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


Ryan Phillips

3/4/2005 9:28:00 PM

0

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



Nikolai Weibull

3/4/2005 9:50:00 PM

0

* 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);}


llothar

3/6/2005 9:31:00 AM

0


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.

You can use ArachnoRuby IDE it's bound to the Shift-Tab key.