diff --git a/src/org/jruby/RubyYAML.java b/src/org/jruby/RubyYAML.java
index e464f0f..3a8c803 100644
@@ -432,8 +432,10 @@ public class RubyYAML {
}
@JRubyMethod(name = "to_yaml", rest = true)
public static IRubyObject obj_to_yaml(IRubyObject self, IRubyObject[] args) {
- ThreadContext context = self.getRuntime().getCurrentContext();
- return self.getRuntime().fastGetModule("YAML").callMethod(context,"dump", self);
+ IRubyObject[] newArgs = new IRubyObject[args.length + 1];
+ newArgs[0] = self;
+ System.arraycopy(args, 0, newArgs, 1, args.length);
+ return dump(self.getRuntime().fastGetModule("YAML"), newArgs);
}
@JRubyMethod(name = "taguri")
public static IRubyObject obj_taguri(IRubyObject self) {