ruleby 0.8.b6 → 0.8.b7
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.
- data/lib/core/engine.rb +8 -4
- metadata +2 -2
data/lib/core/engine.rb
CHANGED
|
@@ -211,9 +211,9 @@ module Ruleby
|
|
|
211
211
|
end
|
|
212
212
|
|
|
213
213
|
def facts
|
|
214
|
-
@working_memory.facts.collect{|f| f.object}
|
|
214
|
+
@working_memory.facts.collect{|f| f.object}.select{|f| !f.is_a?(InitialFact)}
|
|
215
215
|
end
|
|
216
|
-
|
|
216
|
+
|
|
217
217
|
# This method id called to add a new fact to working memory
|
|
218
218
|
def assert(object,&block)
|
|
219
219
|
@wm_altered = true
|
|
@@ -224,6 +224,10 @@ module Ruleby
|
|
|
224
224
|
def retract(object,&block)
|
|
225
225
|
@wm_altered = true
|
|
226
226
|
fact_helper(object,:minus,&block)
|
|
227
|
+
|
|
228
|
+
# I have mixed feelings about doing this...
|
|
229
|
+
assert InitialFact.new if facts.empty?
|
|
230
|
+
object
|
|
227
231
|
end
|
|
228
232
|
|
|
229
233
|
# This method is called to alter an existing fact. It is essentially a
|
|
@@ -267,11 +271,11 @@ module Ruleby
|
|
|
267
271
|
end
|
|
268
272
|
|
|
269
273
|
def errors
|
|
270
|
-
@root.errors
|
|
274
|
+
@root.nil? ? [] : @root.errors
|
|
271
275
|
end
|
|
272
276
|
|
|
273
277
|
def clear_errors
|
|
274
|
-
@root.clear_errors
|
|
278
|
+
@root.clear_errors if @root
|
|
275
279
|
end
|
|
276
280
|
|
|
277
281
|
def print
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: ruleby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: 4
|
|
5
|
-
version: 0.8.
|
|
5
|
+
version: 0.8.b7
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Joe Kutner
|
|
@@ -11,7 +11,7 @@ autorequire:
|
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
13
|
|
|
14
|
-
date: 2011-
|
|
14
|
+
date: 2011-06-02 00:00:00 -05:00
|
|
15
15
|
default_executable:
|
|
16
16
|
dependencies: []
|
|
17
17
|
|