Skip to content

Commit

Permalink
Encourage arity argument in Proc#curry documentation for procs with v…
Browse files Browse the repository at this point in the history
…ariable arguments

This uses similar language to that used in Method#curry.
  • Loading branch information
jeremyevans committed Mar 18, 2022
1 parent 2fdfd49 commit 634e0a9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proc.c
Expand Up @@ -3569,6 +3569,10 @@ curry(RB_BLOCK_CALL_FUNC_ARGLIST(_, args))
* proc and returns the result. Otherwise, returns another curried proc that
* takes the rest of arguments.
*
* The optional <i>arity</i> argument should be supplied when currying procs with
* variable arguments to determine how many arguments are needed before the proc is
* called.
*
* b = proc {|x, y, z| (x||0) + (y||0) + (z||0) }
* p b.curry[1][2][3] #=> 6
* p b.curry[1, 2][3, 4] #=> 6
Expand Down

0 comments on commit 634e0a9

Please sign in to comment.