Hi --

Hal Fulton <hal9000 / hypermetrics.com> 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:
> 
>    #<Struct::Bar
>     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">
>     <Bam: a=1234 b=a string c=ofsome kind.ahash d=File e=
>     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