naturalsorter 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +1 -1
- data/lib/naturalsorter.rb +4 -0
- data/lib/naturalsorter/version.rb +1 -1
- data/spec/naturalsorter_spec.rb +18 -0
- data/spec/versioncmp_spec.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1efceba12767b1736d4ef3c9cea338fcb28acb1
|
|
4
|
+
data.tar.gz: f0ff0e2df2e64f6ddac53edeffeade414c088221
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21c3ecc8e3113c476ef677f1a3d8992bc859821f8ff96b46ce1deef9e321e26bb675c2cb0fd154fd503d5c7a4889683d657e703a9599e5c70a8ee1aa224994f6
|
|
7
|
+
data.tar.gz: 7baa67121d6bc657f6bfcdaaab14949323f17971d370227185d8ee004c728870abcbc1567a0487a2a7835780352cb21adcd357f1294e3d7423cef1b55a1a0884
|
data/README.markdown
CHANGED
data/lib/naturalsorter.rb
CHANGED
|
@@ -70,24 +70,28 @@ module Naturalsorter
|
|
|
70
70
|
|
|
71
71
|
def self.bigger?(a, b)
|
|
72
72
|
return false if a.eql?( b )
|
|
73
|
+
return false if Versioncmp.compare(a, b) == 0
|
|
73
74
|
newest = self.get_newest a, b
|
|
74
75
|
newest.eql?( a )
|
|
75
76
|
end
|
|
76
77
|
|
|
77
78
|
def self.smaller?(a, b)
|
|
78
79
|
return false if b.eql?( a )
|
|
80
|
+
return false if Versioncmp.compare(a, b) == 0
|
|
79
81
|
newest = self.get_newest a, b
|
|
80
82
|
newest.eql?( b )
|
|
81
83
|
end
|
|
82
84
|
|
|
83
85
|
def self.bigger_or_equal?(a, b)
|
|
84
86
|
return true if a.eql?(b)
|
|
87
|
+
return true if Versioncmp.compare(a, b) == 0
|
|
85
88
|
newest = self.get_newest a, b
|
|
86
89
|
newest.eql?(a)
|
|
87
90
|
end
|
|
88
91
|
|
|
89
92
|
def self.smaller_or_equal?(a, b)
|
|
90
93
|
return true if a.eql?(b)
|
|
94
|
+
return true if Versioncmp.compare(a, b) == 0
|
|
91
95
|
newest = self.get_newest a, b
|
|
92
96
|
newest.eql?(b)
|
|
93
97
|
end
|
data/spec/naturalsorter_spec.rb
CHANGED
|
@@ -219,6 +219,12 @@ describe Naturalsorter::Sorter do
|
|
|
219
219
|
it "returns true" do
|
|
220
220
|
Naturalsorter::Sorter.bigger_or_equal?("2.20", "2.20").should be_true
|
|
221
221
|
end
|
|
222
|
+
it "returns true" do
|
|
223
|
+
Naturalsorter::Sorter.bigger_or_equal?("2.20", "2.20.0").should be_true
|
|
224
|
+
end
|
|
225
|
+
it "returns true" do
|
|
226
|
+
Naturalsorter::Sorter.bigger_or_equal?("2.20", "2.20").should be_true
|
|
227
|
+
end
|
|
222
228
|
it "returns true" do
|
|
223
229
|
Naturalsorter::Sorter.bigger_or_equal?("v3.2.0", "3.2.0").should be_true
|
|
224
230
|
end
|
|
@@ -248,6 +254,12 @@ describe Naturalsorter::Sorter do
|
|
|
248
254
|
it "returns true" do
|
|
249
255
|
Naturalsorter::Sorter.smaller?("2.20", "3.0").should be_true
|
|
250
256
|
end
|
|
257
|
+
it "returns false" do
|
|
258
|
+
Naturalsorter::Sorter.smaller?("2.0", "2.0").should be_false
|
|
259
|
+
end
|
|
260
|
+
it "returns false" do
|
|
261
|
+
Naturalsorter::Sorter.smaller?("2.0", "2.0.0").should be_false
|
|
262
|
+
end
|
|
251
263
|
|
|
252
264
|
end
|
|
253
265
|
|
|
@@ -262,6 +274,12 @@ describe Naturalsorter::Sorter do
|
|
|
262
274
|
it "returns false" do
|
|
263
275
|
Naturalsorter::Sorter.smaller_or_equal?("2.20", "2.9").should be_false
|
|
264
276
|
end
|
|
277
|
+
it "returns false" do
|
|
278
|
+
Naturalsorter::Sorter.smaller_or_equal?("2.20", "2.20").should be_true
|
|
279
|
+
end
|
|
280
|
+
it "returns false" do
|
|
281
|
+
Naturalsorter::Sorter.smaller_or_equal?("2.20.0", "2.20").should be_true
|
|
282
|
+
end
|
|
265
283
|
it "returns true" do
|
|
266
284
|
Naturalsorter::Sorter.smaller_or_equal?("2.20", "2.20").should be_true
|
|
267
285
|
end
|
data/spec/versioncmp_spec.rb
CHANGED