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
=> #<Object:0x2be6cd0>
irb(main):002:0> b = Object.new
=> #<Object:0x2be4900>
irb(main):003:0> a.instance_variable_set(:@b, b)
=> #<Object:0x2be4900>
irb(main):004:0> b.instance_variable_set(:@a, a)
=> #<Object:0x2be6cd0 @b=#<Object:0x2be4900 @a=#<Object:0x2be6cd0 ...>>>
irb(main):005:0> a.inspect
=> "#<Object:0x2be6cd0 @b=#<Object:0x2be4900 @a=#<Object:0x2be6cd0 ...>>>"
irb(main):006:0>

thanks
konstantin