b = ["0-5","100-250","5-25","50-100","250-500","25-50"]
使用排序方法我得到:
b.sort # => ["0-5","25-50","50-100"]
我希望它像这样:
["0-5,"250-500"]
b.sort_by { |a| a.split('-').first.to_i } => ["0-5","250-500"]