Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

reformating/pretty printing ruby

12 views
Skip to first unread message

Graham Foster

unread,
May 20, 2005, 6:07:01 PM5/20/05
to
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)

Thomas Adam

unread,
May 20, 2005, 7:59:36 PM5/20/05
to
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

unread,
May 21, 2005, 3:06:00 AM5/21/05
to
21/05/2005 07:51:17
Thomas Adam <tho...@edulinux.homeunix.org> wrote in message
<2005052023...@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://www.pspad.
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

unread,
May 21, 2005, 8:04:00 AM5/21/05
to
On 5/21/05, Graham Foster <gra...@inca.freeserve.company.unitedkingdom> wrote:
\> I'm a Windows man.. and I don't use VIM. Its PSPAD (http://www.pspad.

> 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 * halos...@gmail.com
* Alternate: aus...@halostatue.ca


0 new messages