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::BlankLine o;
; [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