Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Formatting the Object#inspect output

Reply
Thread Tools

Formatting the Object#inspect output

 
 
Jeffrey Moss
Guest
Posts: n/a
 
      06-22-2005
------=_NextPart_000_006F_01C5773B.2E060750
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

When I'm working with large structures in IRB, I get a lot of output =
that I can't really read all that well, all the #<Array:0xb75713d8 =
@something=3D>[#<This:0xb75ca550>, #<That:0xb7521d02>]>

With larger objects I can't really tell what I'm looking for or where to =
find it, it's just 100+ lines of garbage really, I'd like it to be =
indented......

Any suggestions how I could format this stuff better?

-Jeff
------=_NextPart_000_006F_01C5773B.2E060750--


 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      06-22-2005
Jeffrey Moss <(E-Mail Removed)> wrote:
> When I'm working with large structures in IRB, I get a lot of output
> that I can't really read all that well, all the #<Array:0xb75713d8
> @something=>[#<This:0xb75ca550>, #<That:0xb7521d02>]>
>
> With larger objects I can't really tell what I'm looking for or where
> to find it, it's just 100+ lines of garbage really, I'd like it to be
> indented......
>
> Any suggestions how I could format this stuff better?
>
> -Jeff


Try

require 'pp'

pp <cour complex data structure here>

This might look a bit better. Alternatively you can implement #inspect in
your classes to return any string representation you like. This will also
be used by IRB.

Kind regards

robert

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting a table in text-output lemmchen XML 4 10-13-2005 09:41 AM
Formatting output fron Helper Function in Template? Syntax? D. Shane Fowlkes ASP .Net 1 05-19-2005 06:40 PM
Formatting Repeater oontrol output =?Utf-8?B?UGl0Y2Fpcm5pYQ==?= ASP .Net 1 02-17-2005 04:04 PM
help with formatting output mark C++ 1 06-15-2004 10:33 PM
Need formatting options menu for formatting hard drive Mark T. Computer Support 3 11-24-2003 11:50 PM



Advertisments