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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 238a6f83b8af5a38b48e0e06b8a1a4b34472dcc4
4
- data.tar.gz: a1826dcf7db1926d949c71a4aa8e68d916a0640e
3
+ metadata.gz: 31288187561162fa80c551275812a33dac1b1ce0
4
+ data.tar.gz: d296f211ba4575ccab21182d03d9588e2910482f
5
5
  SHA512:
6
- metadata.gz: 20f72033efe83f6244077dc6c21beee64c97d0789189dfb2242b310e9bda364477d12dc225e38bd6536b58ed659d354812b569332ff0c17ea6b6bfeb23f0ee4f
7
- data.tar.gz: 46092efbaac6f4d1fbb7ff1c1f84d49af172be4593a11620ea911183498f420cded7ddc584e2c54624fe92b8aadb109fe322af196f02055cb1d0416339f7a785
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.each { |v| declare(v) }
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
 
@@ -72,6 +72,10 @@ module Wongi::Engine
72
72
  str
73
73
  end
74
74
 
75
+ def inspect
76
+ to_s
77
+ end
78
+
75
79
  def destroy
76
80
  deleted!
77
81
  end
@@ -1,5 +1,5 @@
1
1
  module Wongi
2
2
  module Engine
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -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.1
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-07 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake