A very interesting problem. Here's how I approached it assuming an alphanumeric array. Partition the array into alpha and numeric subarrays, sort them, and reconstitute based on the position and class of the object in the original array.
arr = ["world", "jim", 4, 1, "apple"]
alpha_num = arr.partition { |l| l.is_a? String }.map(&:sort)
arr.map { |l| l.is_a?(String) ? alpha_num.first.shift : alpha_num.last.shift }
My generalized solution is not much different than that of FMc:
arr = ["world", "jim", 4, 1, "apple", 5, 6]
sorted_hash = arr.group_by(&:class).each_value(&:sort!)
arr.map { |l| sorted_hash[l.class].shift }