Created
July 1, 2011 20:09
-
-
Save qmx/1059294 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
From 7d0e281d713b2f0c70b57206a9388d9cbe158e6e Mon Sep 17 00:00:00 2001 | |
From: Douglas Campos <[email protected]> | |
Date: Tue, 7 Jun 2011 20:49:30 -0300 | |
Subject: [PATCH] allowing blocks with arity > 2 | |
--- | |
src/org/jruby/RubyEnumerable.java | 8 +++++++- | |
1 files changed, 7 insertions(+), 1 deletions(-) | |
diff --git a/src/org/jruby/RubyEnumerable.java b/src/org/jruby/RubyEnumerable.java | |
index 2d7f9ac..0a4aaad 100644 | |
--- a/src/org/jruby/RubyEnumerable.java | |
+++ b/src/org/jruby/RubyEnumerable.java | |
@@ -114,7 +114,13 @@ public class RubyEnumerable { | |
} | |
public static IRubyObject checkArgs(Ruby runtime, IRubyObject[]largs) { | |
- return largs.length == 0 ? runtime.getNil() : largs[0]; | |
+ if (largs.length == 0) { | |
+ return runtime.getNil(); | |
+ } else if (largs.length == 1) { | |
+ return largs[0]; | |
+ } else { | |
+ return runtime.newArray(largs); | |
+ } | |
} | |
@JRubyMethod | |
-- | |
1.7.5.4+GitX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment