並び替え
Top > Ruby [2.2.2] > sort , sort_by , reverse
ary = [1,9,5,8,3,2,1] p ary.sort # [1, 1, 2, 3, 5, 8, 9] p ary.reverse # [1, 2, 3, 8, 5, 9, 1] p ary.sort.reverse # [9, 8, 5, 3, 2, 1, 1] p ary.sort_by { |v| v } # [1, 1, 2, 3, 5, 8, 9]