Sort an Array of Strings by their Integer Values
If you convert all strings to integers beforehand, it should work as expected:
a.map(&:to_i).sort
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
I'll throw another method out there since it's the shortest way I can think of
a.sort_by(&:to_i)
As your updated question states:
array.sort_by {|elt| ary = elt.split("-").map(&:to_i); ary[0] + ary[1]}
even geekier:
array.sort_by {|elt| ary = elt.split("-").map(&:to_i).inject(&:+)}