Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/stable_sort/extension/array.rb
Instance Method Summary collapse
Instance Method Details
#stable_sort! ⇒ Object
6 7 8 |
# File 'lib/stable_sort/extension/array.rb', line 6 def stable_sort! stable_sort_by! { |x| x } end |
#stable_sort_by! ⇒ Object
2 3 4 5 |
# File 'lib/stable_sort/extension/array.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 |