summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-proc-ext/mrblib/proc.rb
diff options
context:
space:
mode:
authorJared Breeden <[email protected]>2015-06-22 23:20:24 -0700
committerJared Breeden <[email protected]>2015-06-22 23:20:24 -0700
commit18337266f838003d631d2c02e6d847ae5375a839 (patch)
treeccf038939213da30b99ba8931d87bc0d719dbc8a /mrbgems/mruby-proc-ext/mrblib/proc.rb
parent9781580c7134fcee7bf5a6d4356bc47593549da8 (diff)
parent1001be2e99720f6745159295aa73c649e08adec8 (diff)
downloadmruby-18337266f838003d631d2c02e6d847ae5375a839.tar.gz
mruby-18337266f838003d631d2c02e6d847ae5375a839.zip
Merge branch 'master' of http://github.com/mruby/mruby into alloc_doc
Diffstat (limited to 'mrbgems/mruby-proc-ext/mrblib/proc.rb')
-rw-r--r--mrbgems/mruby-proc-ext/mrblib/proc.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/mrbgems/mruby-proc-ext/mrblib/proc.rb b/mrbgems/mruby-proc-ext/mrblib/proc.rb
index 5dd9981df..b71663938 100644
--- a/mrbgems/mruby-proc-ext/mrblib/proc.rb
+++ b/mrbgems/mruby-proc-ext/mrblib/proc.rb
@@ -13,9 +13,11 @@ class Proc
end
def curry(arity=self.arity)
+ type = :proc
abs = lambda {|a| a < 0 ? -a - 1 : a}
arity = abs[arity]
if lambda?
+ type = :lambda
self_arity = self.arity
if (self_arity >= 0 && arity != self_arity) ||
(self_arity < 0 && abs[self_arity] > arity)
@@ -25,7 +27,7 @@ class Proc
pproc = self
make_curry = proc do |given_args=[]|
- proc do |*args|
+ send(type) do |*args|
new_args = given_args + args
if new_args.size >= arity
pproc[*new_args]