instance method
ObjectSpace#dump_shapes
dump_shapes(output: :file, since: 0)
ext/objspace/lib/objspace.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ext/objspace/lib/objspace.rb, line 116
def dump_shapes(output: :file, since: 0)
out = case output
when :file, nil
require 'tempfile'
Tempfile.create(%w(rubyshapes .json))
when :stdout
STDOUT
when :string
+''
when IO
output
else
raise ArgumentError, "wrong output option: #{output.inspect}"
end
ret = _dump_shapes(out, since)
return nil if output == :stdout
ret
end
Dump the contents of the ruby shape tree as JSON.
output argument is the same as for dump.
If since 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.