xenum 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/xenum/version.rb +1 -1
- data/lib/xenum.rb +18 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6702efc29813e62dabd6f74d9c7bc8067b191a79f3b416f6a1336ba20e6497d4
|
4
|
+
data.tar.gz: 94676ca2107d67c7680d2e6b963e67c5e19f7ab8386c9808e96c751dcafe34ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f82eac1237b52b16d7950bcaee008811a71ad905e966141893a13a51d04aa8ea9590d47590099f2eb204ec5d2df1a3b75a26db1e3ad5d0a6c159c56bf84776f2
|
7
|
+
data.tar.gz: 71df4dec9373651f55a6b5f9abbd4b74f0778b6be2726de4a69735886c0b5528c4e47a46f9d65fb7119b4c3ffa0ee655ce26b092273dfd1ec4b9eedb2bd23b81
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/xenum/version.rb
CHANGED
data/lib/xenum.rb
CHANGED
@@ -55,7 +55,24 @@ module Enumerable
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
def merge_sort(
|
58
|
+
def merge_sort(*enums)
|
59
|
+
case enums.size
|
60
|
+
when 0
|
61
|
+
self
|
62
|
+
when 1
|
63
|
+
_merge_sort(enums[0])
|
64
|
+
else
|
65
|
+
enums2 = enums.pop((enums.size / 2) - 1)
|
66
|
+
enum2 = enums.pop
|
67
|
+
e2 = enum2.merge_sort(*enums2)
|
68
|
+
e1 = merge_sort(*enums)
|
69
|
+
e1.merge_sort(e2)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def _merge_sort(that)
|
59
76
|
this = Enumerator === self ? self : self.to_enum
|
60
77
|
that = Enumerator === that ? that : that.to_enum
|
61
78
|
|
@@ -103,8 +120,6 @@ module Enumerable
|
|
103
120
|
end
|
104
121
|
end
|
105
122
|
|
106
|
-
private
|
107
|
-
|
108
123
|
def lazy_insert_neg(index, objs)
|
109
124
|
these = Enumerator === self ? self : self.to_enum
|
110
125
|
queue = []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xenum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|