wongi-engine 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hgtags +3 -0
- data/lib/wongi-engine/compiler.rb +7 -1
- data/lib/wongi-engine/token.rb +4 -0
- data/lib/wongi-engine/version.rb +1 -1
- data/spec/rule_specs/any_rule_spec.rb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31288187561162fa80c551275812a33dac1b1ce0
|
4
|
+
data.tar.gz: d296f211ba4575ccab21182d03d9588e2910482f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c63c6fa2e5ff49de30f6c6761c20df5c8d1935e51a460e8a9c8f4ae898e710a88810e630c127dd18ec83c73a490d718f4076b48b367961f08343f8bfba61bcc2
|
7
|
+
data.tar.gz: 404bbafd48cb571a8baaa657d6af5c4cec93492f54321e61e863f009e3aed867b1165b4e1c5afff9422803de7451c7ed25ba8c9d9721ebb1c9c63cccb60b428f
|
data/.hgtags
CHANGED
@@ -13,3 +13,6 @@ a2f9d52603db027baced51f673daf46b8fe8745a v0.2.9
|
|
13
13
|
da4529420721bdd153839261e624b3738e7355e9 v0.2.9
|
14
14
|
6db5e2b3978269c475ec03f45bdfb477ca70b427 v0.3.0
|
15
15
|
b5c5b166f6a7375da3a3702667be6e16d43862bd v0.3.1
|
16
|
+
38599f5213374f7e5b6a8d237460f386e5cb6411 v0.3.2
|
17
|
+
38599f5213374f7e5b6a8d237460f386e5cb6411 v0.3.2
|
18
|
+
79e6ff2373b240ca3fab2c185b91d2c3e75cb5bb v0.3.2
|
@@ -77,13 +77,19 @@ module Wongi::Engine
|
|
77
77
|
|
78
78
|
def or_node(variants)
|
79
79
|
beta_memory
|
80
|
+
subvariables = []
|
80
81
|
branches = variants.map do |variant|
|
81
82
|
subcompiler = Compiler.new(rete, node, variant.conditions, parameters, false)
|
82
83
|
declared_variables.each { |v| subcompiler.declare(v) }
|
83
84
|
subcompiler.compile
|
84
|
-
subcompiler.declared_variables
|
85
|
+
subvariables << subcompiler.declared_variables
|
85
86
|
subcompiler.node
|
86
87
|
end
|
88
|
+
subvariables.each do |variables|
|
89
|
+
variables.each do |v|
|
90
|
+
declare(v)
|
91
|
+
end
|
92
|
+
end
|
87
93
|
self.node = OrNode.new(branches).tap &:refresh
|
88
94
|
end
|
89
95
|
|
data/lib/wongi-engine/token.rb
CHANGED
data/lib/wongi-engine/version.rb
CHANGED
@@ -74,4 +74,36 @@ describe "ANY rule" do
|
|
74
74
|
|
75
75
|
end
|
76
76
|
|
77
|
+
context "with two options and same assignments" do
|
78
|
+
let :production do
|
79
|
+
engine << rule do
|
80
|
+
forall {
|
81
|
+
any {
|
82
|
+
option {
|
83
|
+
has :A, :path1, :PathVar
|
84
|
+
}
|
85
|
+
option {
|
86
|
+
has :A, :path2, :PathVar
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
make {
|
91
|
+
collect :PathVar, :paths
|
92
|
+
}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
specify 'should fire on the first path', debug: true do
|
97
|
+
engine << [:x, :path1, true]
|
98
|
+
expect(production.tokens).to have(1).item
|
99
|
+
expect(engine.collection(:paths)).to include(true)
|
100
|
+
end
|
101
|
+
|
102
|
+
specify 'should fire on the second path', debug: true do
|
103
|
+
engine << [:x, :path2, true]
|
104
|
+
expect(production.tokens).to have(1).item
|
105
|
+
expect(engine.collection(:paths)).to include(true)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
77
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wongi-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valeri Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|