wongi-engine 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hgignore +1 -0
- data/.hgtags +1 -0
- data/README.md +8 -7
- data/lib/wongi-engine/beta/join_node.rb +1 -1
- data/lib/wongi-engine/version.rb +1 -1
- data/spec/rule_specs/or_rule_spec.rb +50 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 238a6f83b8af5a38b48e0e06b8a1a4b34472dcc4
|
4
|
+
data.tar.gz: a1826dcf7db1926d949c71a4aa8e68d916a0640e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20f72033efe83f6244077dc6c21beee64c97d0789189dfb2242b310e9bda364477d12dc225e38bd6536b58ed659d354812b569332ff0c17ea6b6bfeb23f0ee4f
|
7
|
+
data.tar.gz: 46092efbaac6f4d1fbb7ff1c1f84d49af172be4593a11620ea911183498f420cded7ddc584e2c54624fe92b8aadb109fe322af196f02055cb1d0416339f7a785
|
data/.hgignore
CHANGED
data/.hgtags
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
# Wongi::Engine
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Gem](https://img.shields.io/gem/v/wongi-engine.svg)](https://rubygems.org/gems/wongi-engine/)
|
4
|
+
[![Build Status](https://travis-ci.org/ulfurinn/wongi-engine.svg?branch=master)](https://travis-ci.org/ulfurinn/wongi-engine)
|
4
5
|
|
5
|
-
|
6
|
+
Ruby >= 2.1 and JRuby are supported. Rubinius should work but isn't actively supported.
|
6
7
|
|
7
|
-
[
|
8
|
-
|
9
|
-
[Open discussions](https://github.com/ulfurinn/wongi-engine/issues?q=is%3Aopen+is%3Aissue+label%3Adiscussion)
|
10
|
-
|
11
|
-
[Tutorial](http://ulfurinn.github.io/wongi-engine/)
|
8
|
+
## [Documentation](http://ulfurinn.github.io/wongi-engine/)
|
12
9
|
|
13
10
|
This library contains a rule engine written in Ruby. It's based on the [Rete algorithm](http://en.wikipedia.org/wiki/Rete_algorithm) and uses a DSL to express rules in a readable way.
|
14
11
|
|
15
12
|
**Word of caution**: this is complex and fragile machinery, and there may be subtle bugs that are only revealed with nontrivial usage. Be conservative with upgrades, test your rules extensively, and please report any behaviour that is not consistent with your expectations.
|
16
13
|
|
14
|
+
[Feature annoucements](https://github.com/ulfurinn/wongi-engine/issues?q=is%3Aopen+is%3Aissue+label%3Aannoucement)
|
15
|
+
|
16
|
+
[Open discussions](https://github.com/ulfurinn/wongi-engine/issues?q=is%3Aopen+is%3Aissue+label%3Adiscussion)
|
17
|
+
|
17
18
|
## Acknowledgements
|
18
19
|
|
19
20
|
The Rete implementation in this library largely follows the outline presented in [\[Doorenbos, 1995\]](http://reports-archive.adm.cs.cmu.edu/anon/1995/CMU-CS-95-113.pdf).
|
data/lib/wongi-engine/version.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "ANY rule" do
|
4
|
+
|
5
|
+
include Wongi::Engine::DSL
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
@engine = Wongi::Engine.create
|
9
|
+
end
|
10
|
+
|
11
|
+
def engine
|
12
|
+
@engine
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'with two options' do
|
16
|
+
|
17
|
+
let :production do
|
18
|
+
engine << rule do
|
19
|
+
forall {
|
20
|
+
any {
|
21
|
+
option {
|
22
|
+
has :A, :path1, :_
|
23
|
+
}
|
24
|
+
option {
|
25
|
+
has :A, :path2, :_
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should fire on the first path' do
|
33
|
+
engine << [:x, :path1, true]
|
34
|
+
expect(production.tokens).to have(1).item
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should fire on the second path' do
|
38
|
+
engine << [:x, :path2, true]
|
39
|
+
expect(production.tokens).to have(1).item
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should fire twice on both paths at once' do
|
43
|
+
engine << [:x, :path1, true]
|
44
|
+
engine << [:x, :path2, true]
|
45
|
+
expect(production.tokens).to have(2).items
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
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.1
|
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-
|
11
|
+
date: 2017-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- spec/rule_specs/maybe_rule_spec.rb
|
161
161
|
- spec/rule_specs/ncc_spec.rb
|
162
162
|
- spec/rule_specs/negative_rule_spec.rb
|
163
|
+
- spec/rule_specs/or_rule_spec.rb
|
163
164
|
- spec/ruleset_spec.rb
|
164
165
|
- spec/simple_action_spec.rb
|
165
166
|
- spec/spec_helper.rb
|
@@ -206,6 +207,7 @@ test_files:
|
|
206
207
|
- spec/rule_specs/maybe_rule_spec.rb
|
207
208
|
- spec/rule_specs/ncc_spec.rb
|
208
209
|
- spec/rule_specs/negative_rule_spec.rb
|
210
|
+
- spec/rule_specs/or_rule_spec.rb
|
209
211
|
- spec/ruleset_spec.rb
|
210
212
|
- spec/simple_action_spec.rb
|
211
213
|
- spec/spec_helper.rb
|