itsme213 wrote: > Where would I find a nice summary of to_s, inspect, p, etc. and the core > ones to override for various purposes? I think ri would help, but I will summarize this below. > Are to_s, inspect, etc. defined more-or-less consistently for the library > classes? Are they used consistently by the various tools like irb, debug, > test/unit, breakpoint, etc? ..inspect is usually used for debug purposes and .to_s for end-user purposes. p obj is the same as puts obj.inspect. irb and breakpoint both use .inspect -- I am not sure about test/unit but would it expect it to also use it. > I often find myself with quite unhelpful presentations of objects e.g. when > a test/unit assertion fails, I might get a 2-page long description of one of > the objects involved. For my own classes I poke around at to_s and friends > but it often feels like guesswork. prettyprint.rb helps in that case -- it wraps and indents the structure of the Object. There's also an extension that provides pp_s which is to pp as inspect is to p.