From: ara.t.howard@... Date: 2006-02-14T03:05:25+09:00 Subject: Re: inspecting cyclic structures On Tue, 14 Feb 2006, konsu wrote: > hello, > > is there a way to inspect an object only to a given depth to avoid infinite > loops in case of referential loops? like irb does: > > irb(main):001:0> a = Object.new > => # > irb(main):002:0> b = Object.new > => # > irb(main):003:0> a.instance_variable_set(:@b, b) > => # > irb(main):004:0> b.instance_variable_set(:@a, a) > => #>> > irb(main):005:0> a.inspect > => "#>>" > irb(main):006:0> > > thanks > konstantin harp:~ > cat a.rb a = Object.new b = Object.new a.instance_variable_set(:@b, b) b.instance_variable_set(:@a, a) p a require "yaml" and y a require "pp" and pp a harp:~ > ruby a.rb #>> --- &id001 !ruby/object b: !ruby/object a: *id001 #>> hth. -a -- judge your success by what you had to give up in order to get it. - h.h. the 14th dali lama