ext/oj/mimic_json.c in oj-3.0.4 vs ext/oj/mimic_json.c in oj-3.0.5

- old
+ new

@@ -752,13 +752,15 @@ if (rb_const_defined_at(ext, rb_intern("Generator"))) { generator = rb_const_get_at(ext, rb_intern("Generator")); } else { generator = rb_define_module_under(ext, "Generator"); } - + if (!rb_const_defined_at(generator, rb_intern("State"))) { + rb_require("oj/state"); + } + // convince Ruby that the json gem has already been loaded // Pull in the JSON::State mimic file. - rb_require("oj/state"); state_class = rb_const_get_at(generator, rb_intern("State")); // TBD create all modules in mimic_loaded rb_define_module_function(json, "create_id=", mimic_set_create_id, 1); rb_define_module_function(json, "create_id", mimic_create_id, 0);