diff options
| author | Jared Breeden <[email protected]> | 2015-06-22 23:20:24 -0700 |
|---|---|---|
| committer | Jared Breeden <[email protected]> | 2015-06-22 23:20:24 -0700 |
| commit | 18337266f838003d631d2c02e6d847ae5375a839 (patch) | |
| tree | ccf038939213da30b99ba8931d87bc0d719dbc8a /mrbgems/mruby-proc-ext/mrblib/proc.rb | |
| parent | 9781580c7134fcee7bf5a6d4356bc47593549da8 (diff) | |
| parent | 1001be2e99720f6745159295aa73c649e08adec8 (diff) | |
| download | mruby-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.rb | 4 |
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] |
