[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

reformating/pretty printing ruby

Graham Foster

5/20/2005 10:07:00 PM

I'd like to be able to reformat a block of Ruby within my editor. One
way would be write the block to a text file and use Ruby to figure
out how to prettyprint itself back to stdout, which I can then
capture back into the editor - all spruced up.
Question is - what is does the Ruby look like to pretty print itself?
Regards,
Graham (Newbie)
3 Answers

Thomas Adam

5/21/2005

0

On Sat, May 21, 2005 at 07:15:15AM +0900, Graham Foster wrote:
> I'd like to be able to reformat a block of Ruby within my editor. One

You don't say which editor, but you can use:

ggVG=

from within vim (in command mode) to reindent a block of code.

-- Thomas Adam

--
"One of us is a cigar stand, and one of us is a lovely blue incandescent
guillotine" -- Stephen Malkmus, "Type Slowly" from "Brighten The Corners"


Graham Foster

5/21/2005 7:06:00 AM

0

21/05/2005 07:51:17
Thomas Adam <thomas@edulinux.homeunix.org> wrote in message
<20050520235926.GC1727@edulinux.homeunix.org>

> On Sat, May 21, 2005 at 07:15:15AM +0900, Graham Foster wrote:
> > I'd like to be able to reformat a block of Ruby within my editor.
One
>
> You don't say which editor, but you can use:
>
> ggVG=
>
> from within vim (in command mode) to reindent a block of code.

I'm a Windows man.. and I don't use VIM. Its PSPAD (http:/....
com) and like many other editors it has a shell to OS and capture
Stdout facility. (I was interested in how to do this reformatting
generically. It looks like there is a Prettyprint module within Ruby
1.8 (its not mentioned in Pickaxe v1), but I don't understand how it
works.
Graham

Austin Ziegler

5/21/2005 12:04:00 PM

0

On 5/21/05, Graham Foster <graham@inca.freeserve.company.unitedkingdom> wrote:
\> I'm a Windows man.. and I don't use VIM. Its PSPAD (http:/....
> com) and like many other editors it has a shell to OS and capture
> Stdout facility. (I was interested in how to do this reformatting
> generically. It looks like there is a Prettyprint module within Ruby
> 1.8 (its not mentioned in Pickaxe v1), but I don't understand how it
> works.

It doesn't pretty print Ruby code. It pretty prints data. It's
something of #inspect on steroids.

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca