From 983476fbab9a769532f38da5692e7c5e4390f1c7 Mon Sep 17 00:00:00 2001 From: drbrain Date: Mon, 3 Oct 2011 23:16:11 +0000 Subject: * proc.c (proc_call): Update documentation to match argument handling of proc/Proc.new/lambda/->() git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ proc.c | 17 +++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 644beb193e..c3a8b5f156 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Oct 4 08:15:50 2011 Eric Hodel + + * proc.c (proc_call): Update documentation to match argument handling + of proc/Proc.new/lambda/->() + Tue Oct 4 07:59:16 2011 Eric Hodel * proc.c (proc_call): Fix documentation of Proc#call vs Proc#===. diff --git a/proc.c b/proc.c index e58bc0817b..eeb8f09ae7 100644 --- a/proc.c +++ b/proc.c @@ -519,10 +519,10 @@ proc_lambda(void) * to an array). Note that prc.() invokes prc.call() with the parameters * given. It's a syntax sugar to hide "call". * - * For procs created using Kernel.proc an error is generated - * if the wrong number of parameters are passed to a proc with multiple - * parameters. For procs created using Proc.new, extra - * parameters are silently discarded. + * For procs created using lambda or ->() an error + * is generated if the wrong number of parameters are passed to a Proc with + * multiple parameters. For procs created using Proc.new or + * Kernel.proc, extra parameters are silently discarded. * * Returns the value of the last expression evaluated in the block. See * also Proc#yield. @@ -530,14 +530,15 @@ proc_lambda(void) * a_proc = Proc.new {|a, *b| b.collect {|i| i*a }} * a_proc.call(9, 1, 2, 3) #=> [9, 18, 27] * a_proc[9, 1, 2, 3] #=> [9, 18, 27] - * a_proc = Proc.new {|a,b| a} + * a_proc = lambda {|a,b| a} * a_proc.call(1,2,3) * * produces: * - * prog.rb:5: wrong number of arguments (3 for 2) (ArgumentError) - * from prog.rb:4:in `call' - * from prog.rb:5 + * prog.rb:4:in `block in
': wrong number of arguments (3 for 2) (ArgumentError) + * from prog.rb:5:in `call' + * from prog.rb:5:in `
' + * */ static VALUE -- cgit v1.2.3