From: David Alan Black Date: 2004-05-25T09:08:44+09:00 Subject: Re: pp and (my) sstruct Hi -- Hal Fulton writes: > OK, I've narrowed the problem down a little further. > > I have this sstruct class which is like Struct or OpenStruct but with > some other features. > > If you're curious, see the rubyforge snippet: > http://rubyforge.org/snippet/detail.php?type=snippet&id=25 > > The point here is, it doesn't quite work with pp for whatever reason. > > Here's an example showing how an ordinary Struct prettyprints, and > then a so-called SuperStruct for comparison. > > This problem is likely related to the nontrivial metaprogramming I'm > doing in sstruct. > > > Ideas, anyone?? [...] > #### Output: > > # a=[1, 2, 3, 4], > b="a string", > c={"of"=>"some kind.", "a"=>"hash"}, > d=File, > e=nil, > f=[["an", "array"], ["of", "arrays"]], > g="blah", > h="blah", > i="blah"> > f=anarrayofarrays g=blah h=blah i=blah> You've defined #inspect, and that's what's being used. From pp.rb: If (({self})) has a customized (redefined) (({inspect})) method, the result of (({self.inspect})) is used but it obviously has no line break hints. David -- David A. Black dblack@wobblini.net