Module: Enumerable

Defined in:
lib/ruby19_stable_sort.rb

Instance Method Summary collapse

Instance Method Details

#stable_sort_by(&block) ⇒ Object



2
3
4
# File 'lib/ruby19_stable_sort.rb', line 2

def stable_sort_by(&block)
  sort_by.with_index {|item, index| [block[item], index] }
end