Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/org/jruby/RubyYAML.java b/src/org/jruby/RubyYAML.java
index e464f0f..3a8c803 100644
--- a/src/org/jruby/RubyYAML.java
+++ b/src/org/jruby/RubyYAML.java
@@ -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) {