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. Advertising

  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. Advertising

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. deluxstar
    Replies:
    5
    Views:
    876
    Terry Reedy
    Sep 25, 2010
  2. Bertram Scharpf

    Object#inspect's output

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

    object.inspect not working

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

    getting Object#inspect back

    OliverMarchand, Oct 12, 2006, in forum: Ruby
    Replies:
    3
    Views:
    122
    Mauricio Fernandez
    Oct 12, 2006
Loading...

Share This Page