wongi-engine 0.1.0 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 242f2dfca581ccebad701500d1329f56645942a6
4
- data.tar.gz: fa9eb4e93e95ab0e06ea8dc5475fbfc8b07e5fcd
3
+ metadata.gz: c142541d4a9b7743bb902181879415cd71711e28
4
+ data.tar.gz: 2e3295767ec8e6d9cf0ff7b30eafe5c6b2e3c2d7
5
5
  SHA512:
6
- metadata.gz: 9db3fcb8333c246b124137c6ba0dcb654816283f3c389c2162268230a2c9acc818f986956a4f0171057564f3dd172ec9b6fdc551b9e1523a44d864ac8fbf7f98
7
- data.tar.gz: 1bdef60a60134e32676e880c61f02948e42b34c43baff937b7713d40e2b17fb40c5e5da19fceb1b9845c2f61753ee93e591fd166c1a477e96d5b83fe6d9a472b
6
+ metadata.gz: c8f67c21c7182067a96b611c57bb25986c814f0cb5822b27744f8d289de2e750ad46fbc2766003912f8c3562f793c1909e5d2b2ed5fe051ac573a7b9486d88e6
7
+ data.tar.gz: d615dd81a8e8f29417aae2806569278cf6d48ff58c40db352be66de6ccf7fd5de06137a489bba82a24cea64e81ac18a8a9d2d015d2b2d675dd11587b52089f6d
data/.hgtags CHANGED
@@ -1 +1,6 @@
1
1
  b1dfd471a2a9e4a57f0e4932ac184faa5d6fa5b5 v0.1.0.alpha1
2
+ accab6252d5746dafe847935ad55f8500594d0cc v0.1.1
3
+ bcb2b3f279910db9fd7d831bed2eec35ea7f834c v0.1.3
4
+ bcb2b3f279910db9fd7d831bed2eec35ea7f834c v0.1.3
5
+ a9bbf79baec0c02897a43a41dfa0d0c427a05441 v0.1.3
6
+ a1ee475ba255ea50216bb93bac9ff1a32845b8c8 v0.1.4
data/README.md CHANGED
File without changes
@@ -24,7 +24,7 @@ module Wongi::Engine
24
24
 
25
25
  def beta_activate token, wme = nil, assignments = { }
26
26
  children.each do |child|
27
- child.beta_activate Token.new( child, token, nil, { @variable => @body } )
27
+ child.beta_activate Token.new( child, token, nil, { @variable => @body.respond_to?(:call) ? @body.call(token) : @body } )
28
28
  end
29
29
  end
30
30
 
@@ -44,7 +44,7 @@ module Wongi::Engine
44
44
  self.children = [ child ]
45
45
  parent.tokens.each do |token|
46
46
  children.each do |child|
47
- child.beta_activate Token.new( child, token, nil, { @variable => @body } )
47
+ child.beta_activate Token.new( child, token, nil, { @variable => @body.respond_to?(:call) ? @body.call(token) : @body } )
48
48
  end
49
49
  end
50
50
  self.children = tmp
@@ -38,7 +38,7 @@ module Wongi::Engine
38
38
  def subst variable, value
39
39
  @cached_assignments = nil
40
40
  if @assignments.has_key? variable
41
- @assignments[ variable ] = value.respond_to?(:call) ? value : Proc.new { value }
41
+ @assignments[ variable ] = value
42
42
  end
43
43
  end
44
44
 
@@ -48,7 +48,7 @@ module Wongi::Engine
48
48
 
49
49
  def [] var
50
50
  if a = assignments[ var ]
51
- a.call( self )
51
+ a.respond_to?(:call) ? a.call( self ) : a
52
52
  end
53
53
  end
54
54
 
@@ -1,5 +1,5 @@
1
1
  module Wongi
2
2
  module Engine
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -52,4 +52,22 @@ describe "ASSIGN rule" do
52
52
 
53
53
  end
54
54
 
55
+ it 'should be evaluated once' do
56
+ x = 0
57
+ prod = engine << rule {
58
+ forall {
59
+ has :a, :b, :c
60
+ assign :T do
61
+ x += 1
62
+ end
63
+ }
64
+ make {
65
+ gen :d, :e, :T
66
+ gen :f, :g, :T
67
+ }
68
+ }
69
+ engine << [:a, :b, :c]
70
+ expect(x).to be == 1
71
+ end
72
+
55
73
  end
data/wongi-engine.gemspec CHANGED
File without changes
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.1.0
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valeri Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-21 00:00:00.000000000 Z
11
+ date: 2015-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project:
167
- rubygems_version: 2.4.5
167
+ rubygems_version: 2.4.5.1
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: A forward-chaining rule engine in pure Ruby.