@@ -134,7 +134,7 @@ public static IRubyObject from_state(ThreadContext context, IRubyObject klass, I
134134
135135 @ JRubyMethod (meta =true )
136136 public static IRubyObject generate (ThreadContext context , IRubyObject klass , IRubyObject obj , IRubyObject opts , IRubyObject io ) {
137- return fromState (context , opts )._generate (context , obj , io );
137+ return fromState (context , opts ).generate (context , obj , io );
138138 }
139139
140140 static GeneratorState fromState (ThreadContext context , IRubyObject opts ) {
@@ -227,8 +227,8 @@ public IRubyObject initialize_copy(ThreadContext context, IRubyObject vOrig) {
227227 * the result. If no valid JSON document can be created this method raises
228228 * a GeneratorError exception.
229229 */
230- @ JRubyMethod ( visibility = Visibility . PRIVATE )
231- public IRubyObject _generate (ThreadContext context , IRubyObject obj , IRubyObject io ) {
230+ @ JRubyMethod
231+ public IRubyObject generate (ThreadContext context , IRubyObject obj , IRubyObject io ) {
232232 IRubyObject result = Generator .generateJson (context , obj , this , io );
233233 RuntimeInfo info = RuntimeInfo .forRuntime (context .runtime );
234234 if (!(result instanceof RubyString )) {
@@ -247,6 +247,11 @@ public IRubyObject _generate(ThreadContext context, IRubyObject obj, IRubyObject
247247 return resultString ;
248248 }
249249
250+ @ JRubyMethod
251+ public IRubyObject generate (ThreadContext context , IRubyObject obj ) {
252+ return generate (context , obj , context .nil );
253+ }
254+
250255 @ JRubyMethod (name ="[]" )
251256 public IRubyObject op_aref (ThreadContext context , IRubyObject vName ) {
252257 String name = vName .asJavaString ();
0 commit comments