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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a78d523f964aaf9e819f8620dbaafbad5facc1848f1baa511bf3e71625a1b0c9
4
- data.tar.gz: 59e201fe0e71be312e3f1b2545b1dbcfbccb72c7fa04465d33d6da6ed8c14acb
3
+ metadata.gz: 2cd6d39620d1c665267716d2089f1c498a1d0dd4aef5fc4b2cba175590d483a8
4
+ data.tar.gz: 9f6f684e5433a04541761abb0a6379e18093c77fb2e3cd257ae7bba49ada19c1
5
5
  SHA512:
6
- metadata.gz: 55c87a6034b013fe0f424dee4d7b2192eb1cd863c9d96085beebfbfbace4efcdaf4ac1137dcd8a1941679479502e4ef3f6b29f2d26ced05aa82f872a28c568cd
7
- data.tar.gz: f34c14d5cfc770cd2ad502370e17411396fc290aef2988bcccdeb931456add73819a8d7d7a1c5b75565c3565549859e2cbcaeae28960353a2a567bd843841cbf
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 ancestors # TODO: rename #parents
13
+ def parents(*filter)
14
+ filter = Filter.new(*filter)
14
15
  curr = self
15
16
  a = []
16
- a.push curr.node while curr = curr.branch
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 ancestry
26
+ def ancestors
22
27
  curr = self
23
28
  a = []
24
29
  a.unshift curr.node while curr = curr.branch
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tree
4
- VERSION = "0.12.0"
4
+ VERSION = "0.13.0"
5
5
  end
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.12.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-05 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: constrain