Module: Enumerable

Defined in:
lib/rubustrings/action.rb

Instance Method Summary collapse

Instance Method Details

#stable_sortObject



178
179
180
# File 'lib/rubustrings/action.rb', line 178

def stable_sort
  sort_by.with_index { |x, idx| [x, idx] }
end

#stable_sort_byObject



182
183
184
# File 'lib/rubustrings/action.rb', line 182

def stable_sort_by
  sort_by.with_index { |x, idx| [yield(x), idx] }
end