From 8cf43a617953e1ff377cc6635c6517447f6f7fbf Mon Sep 17 00:00:00 2001
From: Henk <henk.van.der.veen@gmail.com>
Date: Tue, 15 Jan 2019 16:03:27 +0100
Subject: [PATCH] Removed Array#stable_sort_by, since it was not stable and the
 name was wrong.

---
 CHANGELOG.md                                  |  4 ++
 lib/roqua-support/version.rb                  |  2 +-
 lib/roqua/core_ext/array/stable_sort_by.rb    | 37 -----------------
 .../core_ext/array/stable_sort_by_spec.rb     | 40 -------------------
 4 files changed, 5 insertions(+), 78 deletions(-)
 delete mode 100644 lib/roqua/core_ext/array/stable_sort_by.rb
 delete mode 100644 spec/roqua/core_ext/array/stable_sort_by_spec.rb

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f513a6..849c230 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.2.0
+
+* Removed Array#stable_sort_by, since it was not stable and the name was wrong.
+
 ## 0.1.21
 
 * Add Errors.add_parameters(add_to: 'error_report')
diff --git a/lib/roqua-support/version.rb b/lib/roqua-support/version.rb
index 3495bcd..25a34a8 100644
--- a/lib/roqua-support/version.rb
+++ b/lib/roqua-support/version.rb
@@ -1,5 +1,5 @@
 module Roqua
   module Support
-    VERSION = '0.1.34'.freeze
+    VERSION = '0.2.0'.freeze
   end
 end
diff --git a/lib/roqua/core_ext/array/stable_sort_by.rb b/lib/roqua/core_ext/array/stable_sort_by.rb
deleted file mode 100644
index 476cc4d..0000000
--- a/lib/roqua/core_ext/array/stable_sort_by.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-class Array
-  # Method for stably sorting elements in an array on multiple attributes.
-  #
-  # * Pass the method a block with two arrays containing the attributes for which the
-  #   elements should be subsequently sorted. The first attribute is applied last.
-  #   If for some attribute the sort order should be reversed, the parameters x and y can
-  #   be exchanged between the arrays.
-  #
-  # ==== Example
-  #   my_array.stable_sort_by{|x, y| [
-  #                            x.attribute1,
-  #                            y.attribute2,
-  #                            y.attribute3,
-  #                            y.attribute4
-  #                          ] <=> [
-  #                            y.attribute1,
-  #                            x.attribute2,
-  #                            x.attribute3,
-  #                            x.attribute4
-  #                          ]}
-  #
-  def stable_sort_by
-    sort do |x, y|
-      if not x
-        -1
-      elsif not y
-        1
-      else
-        if block_given?
-          yield x, y
-        else
-          x <=> y
-        end
-      end
-    end
-  end
-end
\ No newline at end of file
diff --git a/spec/roqua/core_ext/array/stable_sort_by_spec.rb b/spec/roqua/core_ext/array/stable_sort_by_spec.rb
deleted file mode 100644
index ce534c2..0000000
--- a/spec/roqua/core_ext/array/stable_sort_by_spec.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-require 'roqua/core_ext/array/stable_sort_by'
-
-describe Array do
-  describe "#stable_sort_by" do
-    it "wraps #sort" do
-      array = []
-      array.should_receive(:sort)
-      array.stable_sort_by
-    end
-
-    it "sorts nil values before all others" do
-      [1, nil, 3].stable_sort_by.should == [nil, 1, 3]
-    end
-
-    it "defaults to regular comparison" do
-      [1, 3, 2].stable_sort_by.should == [1, 2, 3]
-    end
-
-    it "accepts a block to do complex comparison" do
-      [{a: 2, b: 2, c: 3},
-       {a: 2, b: 2, c: 4},
-       {a: 1, b: 1, c: 6}].stable_sort_by do |x, y|
-        [x[:a], x[:b], x[:c]] <=> [y[:a], y[:b], y[:c]]
-       end.should == [{a: 1, b: 1, c: 6},
-                      {a: 2, b: 2, c: 3},
-                      {a: 2, b: 2, c: 4}]
-    end
-
-    it "leaves items in original order if they are the same" do
-      [{a: 2, b: 2, c: 4},
-       {a: 2, b: 1, c: 3},
-       {a: 1, b: 3, c: 6}].sort do |x, y|
-        [x[:a], x[:b]] <=> [y[:a], y[:b]]
-       end.should == [{a: 1, b: 3, c: 6},
-                      {a: 2, b: 1, c: 3},
-                      {a: 2, b: 2, c: 4}]
-
-    end
-  end
-end
-- 
GitLab