callable_tree 0.3.2 → 0.3.3
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +12 -12
- data/lib/callable_tree/node/internal.rb +25 -10
- data/lib/callable_tree/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3feea9db6a3844729a1644e56d60cc0cf8961e95e5ae5d58fcf4eb10eab6c80d
|
4
|
+
data.tar.gz: 6de275fcb284556be10c22cea0e310adecadebab11bd5b884b736b809543120c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14883eaed6a4655f62908ae53dabadd007e56befb50cb8d5b02790d91441afe3749ecf00019709a5ba39b8bfaafeaa8e475a318e62d1a93f21511ef3611d4238
|
7
|
+
data.tar.gz: b58152e34c1e7b7c3f9941715d7f512f71d40b1abbacbb7481e965ceb34969117c56b4a9ee218ed62f087dedc7d85ffdde1d9f43ab6beb25aa6da8b89b9dfde1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.3] - 2022-02-19
|
4
|
+
|
5
|
+
- Add `recursive` option to `CallableTree::Node::Internal#reject` and `CallableTree::Node::Internal#reject!`.
|
6
|
+
- Add `CallableTree::Node::Internal#find` to return the first node evaluated as `true` by block.
|
7
|
+
|
3
8
|
## [0.3.2] - 2022-02-05
|
4
9
|
|
5
10
|
- Change `CallableTree::Node::Hooks::Call#before_call` to return a new instance.
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
callable_tree (0.3.
|
4
|
+
callable_tree (0.3.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
diff-lcs (1.5.0)
|
10
10
|
rake (13.0.6)
|
11
|
-
rspec (3.
|
12
|
-
rspec-core (~> 3.
|
13
|
-
rspec-expectations (~> 3.
|
14
|
-
rspec-mocks (~> 3.
|
15
|
-
rspec-core (3.
|
16
|
-
rspec-support (~> 3.
|
17
|
-
rspec-expectations (3.
|
11
|
+
rspec (3.11.0)
|
12
|
+
rspec-core (~> 3.11.0)
|
13
|
+
rspec-expectations (~> 3.11.0)
|
14
|
+
rspec-mocks (~> 3.11.0)
|
15
|
+
rspec-core (3.11.0)
|
16
|
+
rspec-support (~> 3.11.0)
|
17
|
+
rspec-expectations (3.11.0)
|
18
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
-
rspec-support (~> 3.
|
20
|
-
rspec-mocks (3.
|
19
|
+
rspec-support (~> 3.11.0)
|
20
|
+
rspec-mocks (3.11.0)
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
-
rspec-support (~> 3.
|
23
|
-
rspec-support (3.
|
22
|
+
rspec-support (~> 3.11.0)
|
23
|
+
rspec-support (3.11.0)
|
24
24
|
|
25
25
|
PLATFORMS
|
26
26
|
x86_64-darwin-19
|
@@ -17,9 +17,7 @@ module CallableTree
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def append(*callables)
|
20
|
-
clone.
|
21
|
-
node.append!(*callables)
|
22
|
-
end
|
20
|
+
clone.append!(*callables)
|
23
21
|
end
|
24
22
|
|
25
23
|
def append!(*callables)
|
@@ -30,21 +28,38 @@ module CallableTree
|
|
30
28
|
self
|
31
29
|
end
|
32
30
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
31
|
+
def find(recursive: false, &block)
|
32
|
+
node = child_nodes.find(&block)
|
33
|
+
return node if node
|
34
|
+
|
35
|
+
if recursive
|
36
|
+
child_nodes
|
37
|
+
.lazy
|
38
|
+
.select { |node| node.is_a?(Internal) }
|
39
|
+
.map { |node| node.find(recursive: true, &block) }
|
40
|
+
.reject(&:nil?)
|
41
|
+
.first
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
39
|
-
def reject
|
45
|
+
def reject(recursive: false, &block)
|
46
|
+
clone.reject!(recursive: recursive, &block)
|
47
|
+
end
|
48
|
+
|
49
|
+
def reject!(recursive: false, &block)
|
40
50
|
child_nodes.reject!(&block)
|
51
|
+
|
52
|
+
if recursive
|
53
|
+
child_nodes.each do |node|
|
54
|
+
node.reject!(recursive: true, &block) if node.is_a?(Internal)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
41
58
|
self
|
42
59
|
end
|
43
60
|
|
44
61
|
def shake(&block)
|
45
|
-
clone.
|
46
|
-
node.shake!(&block)
|
47
|
-
end
|
62
|
+
clone.shake!(&block)
|
48
63
|
end
|
49
64
|
|
50
65
|
def shake!(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: callable_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jsmmr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Builds a tree by linking callable nodes. The nodes that match the conditions
|
14
14
|
are called in a chain from the root node to the leaf node. These are like nested
|
@@ -62,7 +62,7 @@ licenses:
|
|
62
62
|
metadata:
|
63
63
|
homepage_uri: https://github.com/jsmmr/ruby_callable_tree
|
64
64
|
source_code_uri: https://github.com/jsmmr/ruby_callable_tree
|
65
|
-
changelog_uri: https://github.com/jsmmr/ruby_callable_tree/blob/v0.3.
|
65
|
+
changelog_uri: https://github.com/jsmmr/ruby_callable_tree/blob/v0.3.3/CHANGELOG.md
|
66
66
|
post_install_message:
|
67
67
|
rdoc_options: []
|
68
68
|
require_paths:
|