does sort return a new array in Ruby code example
Example 1: ruby sort array numerically
a.sort_by(&:to_i)
Example 2: ruby sort array numerically
a = ["teste", "test", "teste2", "tes3te", "10teste"]
a.sort_by! {|s| s[/\d+/].to_i}
a.sort_by(&:to_i)
a = ["teste", "test", "teste2", "tes3te", "10teste"]
a.sort_by! {|s| s[/\d+/].to_i}