Created
January 12, 2012 18:38
-
-
Save headius/1602285 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/org/jruby/runtime/CallBlock.java b/src/org/jruby/runtime/CallBlock.java | |
index f846abc..4840809 100644 | |
--- a/src/org/jruby/runtime/CallBlock.java | |
+++ b/src/org/jruby/runtime/CallBlock.java | |
@@ -33,6 +33,8 @@ import org.jruby.parser.StaticScope; | |
import org.jruby.parser.StaticScopeFactory; | |
import org.jruby.runtime.builtin.IRubyObject; | |
+import java.util.Arrays; | |
+ | |
/** | |
* A Block implemented using a Java-based BlockCallback implementation. For | |
* lightweight block logic within Java code. | |
diff --git a/src/org/jruby/runtime/JavaInternalBlockBody.java b/src/org/jruby/runtime/JavaInternalBlockBody.java | |
index 262d27a..b00d15b 100644 | |
--- a/src/org/jruby/runtime/JavaInternalBlockBody.java | |
+++ b/src/org/jruby/runtime/JavaInternalBlockBody.java | |
@@ -6,7 +6,6 @@ package org.jruby.runtime; | |
import org.jruby.RubyArray; | |
import org.jruby.RubyModule; | |
-import org.jruby.ast.util.ArgsUtil; | |
import org.jruby.parser.StaticScope; | |
import org.jruby.runtime.Block.Type; | |
import org.jruby.runtime.builtin.IRubyObject; | |
@@ -46,6 +45,29 @@ public abstract class JavaInternalBlockBody extends BlockBody { | |
} | |
@Override | |
+ public IRubyObject call(ThreadContext context, IRubyObject[] args, Binding binding, Block.Type type) { | |
+ IRubyObject value; | |
+ if (args.length == 1) { | |
+ value = args[0]; | |
+ } else { | |
+ value = RubyArray.newArrayNoCopy(context.getRuntime(), args); | |
+ } | |
+ return yield(context, value, null, null, true, binding, type); | |
+ } | |
+ | |
+ @Override | |
+ public IRubyObject call(ThreadContext context, IRubyObject[] args, Binding binding, | |
+ Block.Type type, Block block) { | |
+ IRubyObject value; | |
+ if (args.length == 1) { | |
+ value = args[0]; | |
+ } else { | |
+ value = RubyArray.newArrayNoCopy(context.getRuntime(), args); | |
+ } | |
+ return yield(context, value, null, null, true, binding, type, block); | |
+ } | |
+ | |
+ @Override | |
public IRubyObject yield(ThreadContext context, IRubyObject value, Binding binding, Type type) { | |
threadCheck(context); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment