def sort opts={}
      opts = {ascending: true}.merge(opts)

      new_index = @keys.sort
      new_index = new_index.reverse unless opts[:ascending]

      self.class.new(new_index)
    end
def sort opts={}
      opts = {ascending: true}.merge(opts)

      new_index = @keys.sort
      new_index = new_index.reverse unless opts[:ascending]

      self.class.new(new_index)
    end
Sorts a `Index`, according to its values. Defaults to ascending order
 sorting.

 @param [Hash] opts the options for sort method.
 @option opts [Boolean] :ascending False, to get descending order.

 @return [Index] sorted `Index` according to its values.

 @example
   di = Daru::Index.new [100, 99, 101, 1, 2]
   # Say you want to sort in descending order
   di.sort(ascending: false) #=> Daru::Index.new [101, 100, 99, 2, 1]
   # Say you want to sort in ascending order
   di.sort #=> Daru::Index.new [1, 2, 99, 100, 101]