Hi,
Some questions on the limit/aDepth in dump/_dump related to
the following sample code:
class C
def _dump(aDepth)
puts "depth = #{aDepth}"
"" # Dummy
end
end
#Marshal.dump([C.new],1) # => exceed depth limit (ArgumentError)
Marshal.dump([C.new],2)
bash-2.04$ ruby -v dump_depth.rb
ruby 1.6.1 (2000-09-27) [i686-cygwin]
depth = 0
Questions:
1. Why does dump(Array, limit) subtract 2 from the limit/depth?
My guess was that it would subtract one since the object in the array
is a sub-object to the array "one step down".
2. If I write my own _dump functions should I subtract one or two from the
limit when passing it on to sub-objects?
Regards,
Robert