| Server IP : 162.214.74.102 / Your IP : 216.73.217.46 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Enumerable/ |
Upload File : |
U:RDoc::AnyMethod[iI"sum:ETI"Enumerable#sum;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"2Returns the sum of elements in an Enumerable.;To:RDoc::Markup::BlankLine o;
; [I"?If a block is given, the block is applied to each element ;TI"before addition.;T@o;
; [I"5If <i>enum</i> is empty, it returns <i>init</i>.;T@o;
; [I"For example:;T@o:RDoc::Markup::Verbatim; [ I"6{ 1 => 10, 2 => 20 }.sum {|k, v| k * v } #=> 50
;TI"6(1..10).sum #=> 55
;TI"7(1..10).sum {|v| v * 2 } #=> 110
;TI"=[Object.new].each.sum #=> TypeError
;T:@format0o;
; [I"8This method can be used for non-numeric objects by ;TI"#explicit <i>init</i> argument.;T@o;; [I"G{ 1 => 10, 2 => 20 }.sum([]) #=> [1, 10, 2, 20]
;TI">"a\nb\nc".each_line.lazy.map(&:chomp).sum("") #=> "abc"
;T;
0o;
; [I"FEnumerable#sum method may not respect method redefinition of "+" ;TI"methods such as Integer#+.;T:
@fileI"enum.c;T:0@omit_headings_from_table_of_contents_below0I"_enum.sum(init=0) -> number
enum.sum(init=0) {|e| expr } -> number
;T0[ I"(p1 = v1);T@+FI"Enumerable;TcRDoc::NormalModule00