Class: Enumerator

Inherits:
Object
  • Object
show all
Defined in:
lib/stable_sort/extension/enumerator.rb

Instance Method Summary collapse

Instance Method Details

#stable_sortObject



6
7
8
# File 'lib/stable_sort/extension/enumerator.rb', line 6

def stable_sort
  stable_sort_by { |x| x }
end

#stable_sort_byObject



2
3
4
# File 'lib/stable_sort/extension/enumerator.rb', line 2

def stable_sort_by
  sort_by.with_index{ |e, index| [yield(e), index] }
end