Skip to content

Instantly share code, notes, and snippets.

@qmx
Created July 1, 2011 20:09
Show Gist options
  • Save qmx/1059294 to your computer and use it in GitHub Desktop.
Save qmx/1059294 to your computer and use it in GitHub Desktop.
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