diff options
| author | Asmod4n <[email protected]> | 2015-09-17 13:24:17 +0200 |
|---|---|---|
| committer | Asmod4n <[email protected]> | 2015-09-17 13:24:17 +0200 |
| commit | e6d9b450bab46f218e6bee2c95114b733660951a (patch) | |
| tree | e6e296d99ad3780e769a5bae0d71bb5a6de75c9a /mrbgems/mruby-proc-ext/mrblib/proc.rb | |
| parent | 13a2cc3e5d27c33db7f4cf06ece4c44a79c79c53 (diff) | |
| parent | 070e04ea22d832c323e56ff75242f08ca3022fa8 (diff) | |
| download | mruby-e6d9b450bab46f218e6bee2c95114b733660951a.tar.gz mruby-e6d9b450bab46f218e6bee2c95114b733660951a.zip | |
Merge remote-tracking branch 'mruby/master'
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] |
