Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/stable_sort/extension/array.rb
Instance Method Summary collapse
Instance Method Details
#stable_sort ⇒ Object
10 11 12 |
# File 'lib/stable_sort/extension/array.rb', line 10 def stable_sort stable_sort_by { |x| x } end |
#stable_sort! ⇒ Object
14 15 16 |
# File 'lib/stable_sort/extension/array.rb', line 14 def stable_sort! stable_sort_by! { |x| x } end |
#stable_sort_by ⇒ Object
2 3 4 |
# File 'lib/stable_sort/extension/array.rb', line 2 def stable_sort_by sort_by.with_index{ |e, index| [yield(e), index] } end |
#stable_sort_by! ⇒ Object
6 7 8 |
# File 'lib/stable_sort/extension/array.rb', line 6 def stable_sort_by! sort_by!.with_index{ |e, index| [yield(e), index] } end |