From: Hal Fulton Date: 2004-05-25T10:50:28+09:00 Subject: Re: pp and (my) sstruct Tanaka Akira wrote: > In article <40B29029.4080108@hypermetrics.com>, > Hal Fulton writes: > > >>Hmm, what if I want an inspect (for those who don't use pp), but I >>want it "pretty" for those who do? > > > Define pretty_print and alias inspect pretty_print_inspect. Thanks very much for this reply. Always a pleasure to get advice from the expert. However, 1) I don't understand this and 2) it isn't working for me. I am doing: klass.class_eval do # ... define_method(:pretty_print) do str = "#<#{self.class}:" table.each {|item| str << " #{item}=#{self.send(item)}" } str + ">" end alias inspect pretty_print_inspect #... end But when I do a pp of a SuperStruct, I get a blank line out. And if I remove the pp library and call p, it complains that pretty_print_inspect is not defined. How could this work without "require 'pp'"? Thank you for any clarification. Hal Fulton