Formatting the Object#inspect output

Discussion in 'Ruby' started by Jeffrey Moss, Jun 22, 2005.

  1. Jeffrey Moss

    Jeffrey Moss Guest

    ------=_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--
     
    Jeffrey Moss, Jun 22, 2005
    #1
    1. Advertisements

  2. Jeffrey Moss <> 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
     
    Robert Klemme, Jun 22, 2005
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QnJpYW4gS2l0dA==?=

    How do you inspect HTML controls in compiled C#?

    =?Utf-8?B?QnJpYW4gS2l0dA==?=, May 22, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    624
    Kevin Spencer
    May 30, 2005
  2. deluxstar
    Replies:
    5
    Views:
    1,138
    Terry Reedy
    Sep 25, 2010
  3. Bertram Scharpf

    Object#inspect's output

    Bertram Scharpf, Mar 9, 2005, in forum: Ruby
    Replies:
    2
    Views:
    174
    Bertram Scharpf
    Mar 9, 2005
  4. Navya Amerineni

    object.inspect not working

    Navya Amerineni, May 28, 2005, in forum: Ruby
    Replies:
    3
    Views:
    173
    Caio Tiago Oliveira
    May 29, 2005
  5. Replies:
    1
    Views:
    160
    Michael Fellinger
    Jul 24, 2006
  6. OliverMarchand

    getting Object#inspect back

    OliverMarchand, Oct 12, 2006, in forum: Ruby
    Replies:
    3
    Views:
    191
    Mauricio Fernandez
    Oct 12, 2006
  7. kelly felkins

    inspect...and modify a proc object?

    kelly felkins, Jan 16, 2007, in forum: Ruby
    Replies:
    0
    Views:
    157
    kelly felkins
    Jan 16, 2007
  8. kj
    Replies:
    9
    Views:
    166
    sidney johnson
    Jul 16, 2004
Loading...