Method: JSON::Ext::Generator::State#initialize
- Defined in:
- ext/json/ext/generator/generator.c
#new(opts = {}) ⇒ Object
Instantiates a new State object, configured by opts.
opts can have the following keys:
-
indent: a string used to indent levels (default: ”),
-
space: a string that is put after, a : or , delimiter (default: ”),
-
space_before: a string that is put before a : pair delimiter (default: ”),
-
object_nl: a string that is put at the end of a JSON object (default: ”),
-
array_nl: a string that is put at the end of a JSON array (default: ”),
-
allow_nan: true if NaN, Infinity, and -Infinity should be generated, otherwise an exception is thrown, if these values are encountered. This options defaults to false.
-
ascii_only: true if only ASCII characters should be generated. This option defaults to false.
-
buffer_initial_length: sets the initial length of the generator’s internal buffer.
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
# File 'ext/json/ext/generator/generator.c', line 1103
static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE opts;
GET_STATE(self);
state->max_nesting = 100;
state->buffer_initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
rb_scan_args(argc, argv, "01", &opts);
if (!NIL_P(opts)) cState_configure(self, opts);
return self;
}
|