Formatting the Object#inspect output

J

Jeffrey Moss

------=_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--
 
R

Robert Klemme

Jeffrey Moss said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top