Method: JSON::Ext::Generator::State#generate
- Defined in:
- ext/json/ext/generator/generator.c
#generate(obj) ⇒ Object
Generates a valid JSON document from object obj and returns the result. If no valid JSON document can be created this method raises a GeneratorError exception.
877 878 879 880 881 882 883 884 885 |
# File 'ext/json/ext/generator/generator.c', line 877 static VALUE cState_generate(VALUE self, VALUE obj) { VALUE result = cState_partial_generate(self, obj); GET_STATE(self); if (!state->quirks_mode && !isArrayOrObject(result)) { rb_raise(eGeneratorError, "only generation of JSON objects or arrays allowed"); } return result; } |