Server IP : 111.118.215.189 / Your IP : 216.73.216.153 Web Server : Apache System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : a1673wkz ( 2475) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /proc/thread-self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Proc/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
U:RDoc::AnyMethod[iI" yield:ETI"Proc#yield;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HInvokes the block, setting the block's parameters to the values in ;TI"F<i>params</i> using something close to method calling semantics. ;TI"EReturns the value of the last expression evaluated in the block.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"Oa_proc = Proc.new {|scalar, *values| values.map {|value| value*scalar } } ;TI"0a_proc.call(9, 1, 2, 3) #=> [9, 18, 27] ;TI"0a_proc[9, 1, 2, 3] #=> [9, 18, 27] ;TI"0a_proc.(9, 1, 2, 3) #=> [9, 18, 27] ;TI"0a_proc.yield(9, 1, 2, 3) #=> [9, 18, 27] ;T:@format0o; ; [I"HNote that <code>prc.()</code> invokes <code>prc.call()</code> with ;TI"@the parameters given. It's syntactic sugar to hide "call".;T@o; ; [ I"OFor procs created using <code>lambda</code> or <code>->()</code> an error ;TI"Lis generated if the wrong number of parameters are passed to the proc. ;TI"PFor procs created using <code>Proc.new</code> or <code>Kernel.proc</code>, ;TI"Hextra parameters are silently discarded and missing parameters are ;TI"set to +nil+.;T@o;; [ I""a_proc = proc {|a,b| [a,b] } ;TI"#a_proc.call(1) #=> [1, nil] ;TI" ;TI"$a_proc = lambda {|a,b| [a,b] } ;TI"Wa_proc.call(1) # ArgumentError: wrong number of arguments (given 1, expected 2) ;T; 0o; ; [I"See also Proc#lambda?.;T: @fileI"proc.c;T:0@omit_headings_from_table_of_contents_below0I""prc.yield(params,...) -> obj;T0[ I"(*args);T@-FI" Proc;TcRDoc::NormalClass00