Method: Oj.to_file
- Defined in:
- ext/oj/oj.c
permalink .to_file(file_path, obj, options = {}) ⇒ Object
Dumps an Object to the specified file.
-
file [String] _path file path to write the JSON document to
-
obj [Object] Object to serialize as an JSON document String
-
options [Hash] formatting options
-
:indent [Fixnum] format expected
-
:circular [Boolean] allow circular references, default: false
-
1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 |
# File 'ext/oj/oj.c', line 1397
static VALUE to_file(int argc, VALUE *argv, VALUE self) {
struct _options copts = oj_default_options;
if (3 == argc) {
oj_parse_options(argv[2], &copts);
}
oj_write_obj_to_file(argv[1], StringValuePtr(*argv), &copts);
return Qnil;
}
|