Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

ObjectSpace#dump_shapes

ObjectSpace.dump_shapes([output: :file]) → #<File:/tmp/rubyshapes20131125-88469-laoj3v.json>
ObjectSpace.dump_shapes(output: :stdout) → nil
ObjectSpace.dump_shapes(output: :string) → "{...}\n{...}\n..."
ObjectSpace.dump_shapes(output: File.open('shapes.json','w')) → #<File:shapes.json>
ObjectSpace.dump_all(output: :string, since: 42) → "{...}\n{...}\n..."

Dump the contents of the ruby shape tree as JSON.

If shapes is a positive integer, only shapes newer than the provided shape id are dumped. The current shape_id can be accessed using RubyVM.stat(:next_shape_id).

This method is only expected to work with C Ruby. This is an experimental method and is subject to change. In particular, the function signature and output format are not guaranteed to be compatible in future versions of ruby.

See also #dump_all #garbage_collect #dump also in 4.1 · 4.0 · 3.4 · 3.3