HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/ri/3.0.0/system/Array/sort-i.ri
U:RDoc::AnyMethod[iI"	sort:ETI"Array#sort;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[I"GReturns a new \Array whose elements are those from +self+, sorted.;To:RDoc::Markup::BlankLineo;
;	[I"BWith no block, compares elements using operator <tt><=></tt> ;TI"(see Comparable):;To:RDoc::Markup::Verbatim;	[	I"#a = 'abcde'.split('').shuffle
;TI"&a # => ["e", "b", "d", "a", "c"]
;TI"a1 = a.sort
;TI"'a1 # => ["a", "b", "c", "d", "e"]
;T:@format0o;
;	[I";With a block, calls the block with each element pair; ;TI"Kfor each element pair +a+ and +b+, the block should return an integer:;To:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;	[o;
;	[I"(Negative when +b+ is to follow +a+.;To;;0;	[o;
;	[I"*Zero when +a+ and +b+ are equivalent.;To;;0;	[o;
;	[I"(Positive when +a+ is to follow +b+.;T@o;
;	[I"
Example:;To;;	[I"#a = 'abcde'.split('').shuffle
;TI"&a # => ["e", "b", "d", "a", "c"]
;TI"#a1 = a.sort {|a, b| a <=> b }
;TI"'a1 # => ["a", "b", "c", "d", "e"]
;TI"#a2 = a.sort {|a, b| b <=> a }
;TI"'a2 # => ["e", "d", "c", "b", "a"]
;T;
0o;
;	[I"NWhen the block returns zero, the order for +a+ and +b+ is indeterminate, ;TI"and may be unstable:;To;;	[	I"#a = 'abcde'.split('').shuffle
;TI"&a # => ["e", "b", "d", "a", "c"]
;TI"a1 = a.sort {|a, b| 0 }
;TI"(a1 # =>  ["c", "e", "b", "d", "a"]
;T;
0o;
;	[I"!Related: Enumerable#sort_by.;T:
@fileI"array.c;T:0@omit_headings_from_table_of_contents_below0I"Carray.sort -> new_array
array.sort {|a, b| ... } -> new_array
;T0[I"();T@FFI"
Array;TcRDoc::NormalClass00