module Enumerable

Public Instance Methods

stable_sort() click to toggle source
# File lib/stable_sort/extension/enumerable.rb, line 6
def stable_sort
  stable_sort_by { |x| x }
end
stable_sort_by() { |e| ... } click to toggle source
# File lib/stable_sort/extension/enumerable.rb, line 2
def stable_sort_by
  return to_enum(:stable_sort_by) if !block_given?
  sort_by.with_index{ |e, index| [yield(e), index] }
end