Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
Enumerable
/
//opt/alt/ruby21/share/ri/2.1.0/system/Enumerable/sort-i.ri
U:RDoc::AnyMethod[iI" sort:ETI"Enumerable#sort;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"BReturns an array containing the items in <i>enum</i> sorted, ;TI"Heither according to their own <code><=></code> method, or by using ;TI"Jthe results of the supplied block. The block should return -1, 0, or ;TI"I+1 depending on the comparison between <i>a</i> and <i>b</i>. As of ;TI"GRuby 1.8, the method <code>Enumerable#sort_by</code> implements a ;TI"Dbuilt-in Schwartzian Transform, useful when key computation or ;TI"comparison is expensive.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"A%w(rhea kea flea).sort #=> ["flea", "kea", "rhea"] ;TI"I(1..10).sort { |a, b| b <=> a } #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];T:@format0: @fileI"enum.c;T:0@omit_headings_from_table_of_contents_below0I"Menum.sort -> array enum.sort { |a, b| block } -> array ;T0[ I"();T@FI"Enumerable;TcRDoc::NormalModule00