modular_tree 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/modular_tree/algorithms.rb +8 -3
- data/lib/modular_tree/version.rb +1 -1
- 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: 2cd6d39620d1c665267716d2089f1c498a1d0dd4aef5fc4b2cba175590d483a8
|
4
|
+
data.tar.gz: 9f6f684e5433a04541761abb0a6379e18093c77fb2e3cd257ae7bba49ada19c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72e405f8c4e5dcf4111c964301b482743d2ccec4b644c196fc64f15fe5393f713eb7f2e675f6c6f48a694764b4b055196e18a1a53145bfb6e9af920a6991325a
|
7
|
+
data.tar.gz: 01da8646f20a98c4b4dc85ed7f79e67842a0c5f3836a28a6b1e171f723c861d154ba250bb70243027404daf108f61e09a07a4d2fbf800fcd4a3a3beb9c1d5bee
|
@@ -10,15 +10,20 @@ module Tree
|
|
10
10
|
include BranchesProperty
|
11
11
|
|
12
12
|
# Bottom-up
|
13
|
-
def
|
13
|
+
def parents(*filter)
|
14
|
+
filter = Filter.new(*filter)
|
14
15
|
curr = self
|
15
16
|
a = []
|
16
|
-
|
17
|
+
while curr = curr.branch
|
18
|
+
select, continue = filter.match(curr.node)
|
19
|
+
a.push curr.node if select
|
20
|
+
break if !continue
|
21
|
+
end
|
17
22
|
a
|
18
23
|
end
|
19
24
|
|
20
25
|
# Top-down # TODO: rename #ancestors
|
21
|
-
def
|
26
|
+
def ancestors
|
22
27
|
curr = self
|
23
28
|
a = []
|
24
29
|
a.unshift curr.node while curr = curr.branch
|
data/lib/modular_tree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modular_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: constrain
|