Method: ObjectSpace.dump
- Defined in:
- objspace_dump.c
.dump(obj[, output: :string]) ⇒ Object .dump(obj, output: :file) ⇒ #<File:/tmp/rubyobj20131125-88733-1xkfmpv.json .dump(obj, output: :stdout) ⇒ nil
Dump the contents of a ruby object as JSON.
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.
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'objspace_dump.c', line 362
static VALUE
objspace_dump(int argc, VALUE *argv, VALUE os)
{
static const char filename[] = "rubyobj";
VALUE obj = Qnil, opts = Qnil, output;
struct dump_config dc = {0,};
rb_scan_args(argc, argv, "1:", &obj, &opts);
output = dump_output(&dc, opts, sym_string, filename);
dump_object(obj, &dc);
return dump_result(&dc, output);
}
|