Method: Oj.dump
- Defined in:
- ext/oj/oj.c
.dump(obj, options = {}) ⇒ Object
Dumps an Object (obj) to a string.
-
obj [Object] Object to serialize as an JSON document String
-
options [Hash] same as default_options
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 |
# File 'ext/oj/oj.c', line 1301 static VALUE dump(int argc, VALUE *argv, VALUE self) { struct dump_arg arg; struct _out out; struct copts = ; if (1 > argc) { rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)."); } if (CompatMode == copts.mode) { copts.dump_opts.nan_dump = WordNan; } if (2 == argc) { (argv[1], &copts); } if (CompatMode == copts.mode && copts.escape_mode != ASCIIEsc) { copts.escape_mode = JSONEsc; } arg.out = &out; arg.copts = &copts; arg.argc = argc; arg.argv = argv; oj_out_init(arg.out); arg.out->omit_nil = copts.dump_opts.omit_nil; arg.out->omit_null_byte = copts.dump_opts.omit_null_byte; return rb_ensure(dump_body, (VALUE)&arg, dump_ensure, (VALUE)&arg); } |