The code is as below, and I am trying to understand that this specific code does to_a.sort_by(&:hash).hash in the Hash.hash method. What I do know is that, it first turns the hash into an array, sort the array, and then call the hash method on the Array class. I am trying to understand how exactly was the array sorted by?
class Fixnum
  # Fixnum#hash already implemented for you
end
class Array
  def hash
    each_with_index.inject(0) do |intermediate_hash, (el, i)|
      (el.hash + i.hash) ^ intermediate_hash
    end
  end
end
class Hash
  def hash
    to_a.sort_by(&:hash).hash
  end
end
 
    