Материал из Wiki.crossplatform.ru
(Различия между версиями)
Версия 17:10, 26 мая 2010
Get the max value in an array
[3, 5, 11, 16].max # => 16
["three", "five", "eleven", "sixteen"].max # => "three"
["three", "five", "eleven", "sixteen"].max { |x,y| x.size <=> y.size }
# => "sixteen"