clipsruby 0.0.40 → 0.0.41
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 +4 -4
- data/README.md +337 -404
- data/ext/clipsruby/clipsruby.c +325 -27
- metadata +2 -2
data/README.md
CHANGED
@@ -17,8 +17,9 @@ and use the below API as described.
|
|
17
17
|
|
18
18
|
## API
|
19
19
|
|
20
|
-
###
|
21
|
-
|
20
|
+
### Environment Methods
|
21
|
+
|
22
|
+
#### `CLIPS.create_environment` / `CLIPS::Environment.new`
|
22
23
|
|
23
24
|
Create a new CLIPS environment in which you may define Rules,
|
24
25
|
assert Facts, and instantiate Objects.
|
@@ -28,8 +29,76 @@ env = CLIPS.create_environment
|
|
28
29
|
env2 = CLIPS::Environment.new
|
29
30
|
```
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
#### `CLIPS::Environment._eval` / `CLIPS::Environment#_eval`
|
33
|
+
|
34
|
+
Evaluates a passed string in the CLIPS environment and returns the results.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
CLIPS::Environment._eval(env, "(find-all-facts ((?f my_deftemplate)) TRUE)")
|
38
|
+
env._eval("(find-all-facts ((?f my_deftemplate)) TRUE)")
|
39
|
+
```
|
40
|
+
|
41
|
+
#### `CLIPS::Environment.build` / `CLIPS::Environment#build`
|
42
|
+
|
43
|
+
Build the constructs in the env as defined in a string
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
CLIPS::Environment.build(env, "(deftemplate my_template (slot a) (slot b) (slot c))")
|
47
|
+
env.build("(defrule do-a-thing (my_template (a ?a)) => (println \"a: \" ?a))")
|
48
|
+
```
|
49
|
+
|
50
|
+
#### `CLIPS::Environment.add_udf` / `CLIPS::Environment#add_udf`
|
51
|
+
|
52
|
+
Adds a ruby method as a User Defined Function (udf) to the CLIPS environment
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
class CLIPS::Environment
|
56
|
+
def foo(a, b=2)
|
57
|
+
a + b
|
58
|
+
end
|
59
|
+
|
60
|
+
def bar(word)
|
61
|
+
"You said #{word}!"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
env.add_udf(:foo)
|
66
|
+
CLIPS::Environment.add_udf(env, :bar)
|
67
|
+
```
|
68
|
+
|
69
|
+
#### `CLIPS::Environment.run` / `CLIPS::Environment#run`
|
70
|
+
|
71
|
+
Runs the rules engine, executing items on the agenda.
|
72
|
+
Optionally may take the number of items to run from the agenda as an argument.
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
CLIPS::Environment.run(env, 1)
|
76
|
+
CLIPS::Environment.run(env)
|
77
|
+
env.run(1)
|
78
|
+
env.run
|
79
|
+
```
|
80
|
+
|
81
|
+
#### `CLIPS::Environment.clear` / `CLIPS::Environment#clear`
|
82
|
+
|
83
|
+
Removes constructs and data from the environment.
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
CLIPS::Environment.clear(env)
|
87
|
+
env.clear
|
88
|
+
```
|
89
|
+
|
90
|
+
#### `CLIPS::Environment.reset` / `CLIPS::Environment#reset`
|
91
|
+
|
92
|
+
Removes all facts and instances.
|
93
|
+
Creates facts and instances defined in deffacts and definstances constructs.
|
94
|
+
Resets the values of global variables in the specified environment.
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
CLIPS::Environment.reset(env)
|
98
|
+
env.reset
|
99
|
+
```
|
100
|
+
|
101
|
+
#### `CLIPS::Environment.batch_star` / `env.batch_star`
|
33
102
|
|
34
103
|
Pass the path to a file that will be "batched" into the environment,
|
35
104
|
allowing many CLIPS commands to be entered at once.
|
@@ -39,8 +108,7 @@ CLIPS::Environment.batch_star(env, "./my-batch.bat")
|
|
39
108
|
env.batch_star("./my-batch.bat")
|
40
109
|
```
|
41
110
|
|
42
|
-
|
43
|
-
### `env.save`
|
111
|
+
#### `CLIPS::Environment.save` / `env.save`
|
44
112
|
|
45
113
|
Pass the path in which we'll save the environment constructs.
|
46
114
|
|
@@ -49,8 +117,7 @@ CLIPS::Environment.save(env, "./my-save.clp")
|
|
49
117
|
env.save("./my-save.clp")
|
50
118
|
```
|
51
119
|
|
52
|
-
|
53
|
-
### `env.load`
|
120
|
+
#### `CLIPS::Environment.load` / `env.load`
|
54
121
|
|
55
122
|
Pass the path to a file that will load the constructs stored in the file
|
56
123
|
into the environment. Remember to `reset` the environment if you need.
|
@@ -60,8 +127,7 @@ CLIPS::Environment.load(env, "./my-load.clp")
|
|
60
127
|
env.load("./my-load.clp")
|
61
128
|
```
|
62
129
|
|
63
|
-
|
64
|
-
### `env.save_facts`
|
130
|
+
#### `CLIPS::Environment.save_facts` / `env.save_facts`
|
65
131
|
|
66
132
|
Pass the path in which we'll save the environment facts.
|
67
133
|
The third argument is optional, and determines whether to store the visible or local facts.
|
@@ -76,8 +142,7 @@ CLIPS::Environment.save_facts(env, "./my-save-facts.clp", :visible)
|
|
76
142
|
env.save_facts("./my-save-facts.clp", :visible)
|
77
143
|
```
|
78
144
|
|
79
|
-
|
80
|
-
### `env.load_facts`
|
145
|
+
#### `CLIPS::Environment.load_facts` / `env.load_facts`
|
81
146
|
|
82
147
|
Pass the path to a file that will load the facts stored in the file
|
83
148
|
into the environment.
|
@@ -87,8 +152,7 @@ CLIPS::Environment.load_facts(env, "./my-load-facts.clp")
|
|
87
152
|
env.load_facts("./my-load-facts.clp")
|
88
153
|
```
|
89
154
|
|
90
|
-
|
91
|
-
### `env.bsave`
|
155
|
+
#### `CLIPS::Environment.bsave` / `env.bsave`
|
92
156
|
|
93
157
|
Pass the path in which we'll save the binary representation of the environment constructs.
|
94
158
|
|
@@ -97,8 +161,7 @@ CLIPS::Environment.bsave(env, "./my-bsave.bin")
|
|
97
161
|
env.bsave("./my-bsave.bin")
|
98
162
|
```
|
99
163
|
|
100
|
-
|
101
|
-
### `env.bload`
|
164
|
+
#### `CLIPS::Environment.bload` / `env.bload`
|
102
165
|
|
103
166
|
Pass the path to a binary file that will load the constructs stored in the file
|
104
167
|
into the environment. Remember to `reset` the environment if you need.
|
@@ -108,8 +171,7 @@ CLIPS::Environment.bload(env, "./my-bload.bin")
|
|
108
171
|
env.bload("./my-bload.bin")
|
109
172
|
```
|
110
173
|
|
111
|
-
|
112
|
-
### `env.bsave_facts`
|
174
|
+
#### `CLIPS::Environment.bsave_facts` / `env.bsave_facts`
|
113
175
|
|
114
176
|
Pass the path in which we'll save the binary representation of the environment facts.
|
115
177
|
The third argument is optional, and determines whether to store the visible or local facts.
|
@@ -124,8 +186,7 @@ CLIPS::Environment.bsave_facts(env, "./my-bsave-facts.bin", :visible)
|
|
124
186
|
env.bsave_facts("./my-bsave-facts.bin", :visible)
|
125
187
|
```
|
126
188
|
|
127
|
-
|
128
|
-
### `env.bload_facts`
|
189
|
+
#### `CLIPS::Environment.bload_facts` / `env.bload_facts`
|
129
190
|
|
130
191
|
Pass the path to a binary file that will load the facts stored in the file
|
131
192
|
into the environment.
|
@@ -135,8 +196,7 @@ CLIPS::Environment.bload_facts(env, "./my-bload-facts.bin")
|
|
135
196
|
env.bload_facts("./my-bload-facts.bin")
|
136
197
|
```
|
137
198
|
|
138
|
-
|
139
|
-
### `CLIPS::Environment#assert_string`
|
199
|
+
#### `CLIPS::Environment.assert_string` / `CLIPS::Environment#assert_string`
|
140
200
|
|
141
201
|
Assert a string as a Fact in the CLIPS environment.
|
142
202
|
|
@@ -145,8 +205,7 @@ fact = CLIPS::Environment.assert_string(env, "(foo bar)")
|
|
145
205
|
fact2 = env.assert_string("(bat baz)")
|
146
206
|
```
|
147
207
|
|
148
|
-
|
149
|
-
### `CLIPS::Environment#assert_hash`
|
208
|
+
#### `CLIPS::Environment.assert_hash` / `CLIPS::Environment#assert_hash`
|
150
209
|
|
151
210
|
Asserts a Deftemplate fact into the CLIPS environment
|
152
211
|
|
@@ -155,18 +214,42 @@ fact = CLIPS::Environment.assert_hash(env, :my_deftemplate, a: 1, b: "asdf", c:
|
|
155
214
|
fact2 = env.assert_hash(:my_deftemplate, d: 4.5, e: :asdf)
|
156
215
|
```
|
157
216
|
|
158
|
-
|
159
|
-
|
217
|
+
#### `CLIPS::Environment.make_instance` / `CLIPS::Environment#make_instance`
|
218
|
+
|
219
|
+
Make an Instance in the CLIPS environment.
|
160
220
|
|
161
|
-
|
221
|
+
The first argument can be:
|
222
|
+
|
223
|
+
* a symbol/string representing a string you'd call `make-instance` with in CLIPS code
|
224
|
+
* a symbol/string representing a Defclass in the environment
|
225
|
+
* a `CLIPS::Environment::Defclass` object
|
226
|
+
|
227
|
+
The second argument can be:
|
228
|
+
|
229
|
+
* a symbol/string representing the name of the instance you'd like
|
230
|
+
* a hash holding the key/value pairs for instance slot assignment
|
231
|
+
* `nil`
|
232
|
+
|
233
|
+
The third argument can be:
|
234
|
+
|
235
|
+
* a hash holding the key/value pairs for instance slot assignment
|
162
236
|
|
163
237
|
```ruby
|
164
238
|
instance = CLIPS::Environment.make_instance(env, "(of USER)")
|
165
239
|
instance2 = env.make_instance("(of USER)")
|
240
|
+
instance3 = CLIPS::Environment.make_instance(env, :USER)
|
241
|
+
instance4 = env.make_instance(:USER)
|
242
|
+
instance5 = CLIPS::Environment.make_instance(env, env.find_defclass(:USER))
|
243
|
+
instance6 = env.make_instance(env.find_defclass(:USER))
|
244
|
+
instance7 = CLIPS::Environment.make_instance(env, env.find_defclass(:my_class), foo: "Bar!")
|
245
|
+
instance8 = env.make_instance(env.find_defclass(:my_class), foo: "Bar!")
|
246
|
+
instance9 = CLIPS::Environment.make_instance(env, env.find_defclass(:my_class), :my_instance1, foo: "Bar!")
|
247
|
+
instance10 = env.make_instance(env.find_defclass(:my_class), :my_instance2, foo: "Bar.")
|
248
|
+
instance11 = CLIPS::Environment.make_instance(env, env.find_defclass(:my_class), nil, foo: "Bar?")
|
249
|
+
instance12 = env.make_instance(env.find_defclass(:my_class), nil, foo: "Bar...")
|
166
250
|
```
|
167
251
|
|
168
|
-
|
169
|
-
### `CLIPS::Environment#find_fact`
|
252
|
+
#### `CLIPS::Environment.find_fact` / `CLIPS::Environment#find_fact`
|
170
253
|
|
171
254
|
A light wrapper around the CLIPS find-fact function. Accepts a fact set template and query,
|
172
255
|
returns the first Facts in the environment that match as Ruby objects.
|
@@ -178,8 +261,7 @@ CLIPS::Environment.find_fact(env, "(?f my_deftemplate)", "(eq ?f:b \"asdf\")")
|
|
178
261
|
env.find_fact("(?f my_deftemplate)", "(= ?f:a 1)")
|
179
262
|
```
|
180
263
|
|
181
|
-
|
182
|
-
### `CLIPS::Environment#get_fact_list`
|
264
|
+
#### `CLIPS::Environment.get_fact_list` / `CLIPS::Environment#get_fact_list`
|
183
265
|
|
184
266
|
Return an array of Facts in the environment. Pass an argument of a
|
185
267
|
symbol, string, or Defmodule object in order to only get Facts with deftemplates
|
@@ -194,8 +276,7 @@ CLIPS::Environment.get_fact_list(defmodule)
|
|
194
276
|
env.get_fact_list(defmodule)
|
195
277
|
```
|
196
278
|
|
197
|
-
|
198
|
-
### `CLIPS::Environment#find_all_facts`
|
279
|
+
#### `CLIPS::Environment.find_all_facts` / `CLIPS::Environment#find_all_facts`
|
199
280
|
|
200
281
|
A light wrapper around the CLIPS find-all-facts function. Accepts a fact set template and query,
|
201
282
|
returns Facts in the environment that match as Ruby objects.
|
@@ -207,113 +288,197 @@ CLIPS::Environment.find_all_facts(env, "(?f my_deftemplate)", "(eq ?f:b \"asdf\"
|
|
207
288
|
env.find_all_facts("(?f my_deftemplate)", "(= ?f:a 1)")
|
208
289
|
```
|
209
290
|
|
210
|
-
|
211
|
-
### `CLIPS::Environment#_eval`
|
291
|
+
#### `CLIPS::Environment.facts` / `CLIPS::Environment#facts`
|
212
292
|
|
213
|
-
|
293
|
+
Print all Facts defined in the CLIPS environment
|
214
294
|
|
215
295
|
```ruby
|
216
|
-
CLIPS::Environment.
|
217
|
-
env.
|
296
|
+
CLIPS::Environment.facts(env)
|
297
|
+
env.facts
|
218
298
|
```
|
219
299
|
|
220
|
-
|
221
|
-
### `CLIPS::Environment#build`
|
300
|
+
#### `CLIPS::Environment.get_current_module` / `CLIPS::Environment#get_current_module`
|
222
301
|
|
223
|
-
|
302
|
+
Get the current module in the CLIPS environment
|
224
303
|
|
225
304
|
```ruby
|
226
|
-
CLIPS::Environment.
|
227
|
-
env.
|
305
|
+
CLIPS::Environment.get_current_module(env)
|
306
|
+
env.get_current_module
|
228
307
|
```
|
229
308
|
|
230
|
-
|
231
|
-
### `CLIPS::Environment#add_udf`
|
309
|
+
#### `CLIPS::Environment.set_current_module` / `CLIPS::Environment#set_current_module`
|
232
310
|
|
233
|
-
|
311
|
+
Set the current module in the CLIPS environment
|
234
312
|
|
235
313
|
```ruby
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
end
|
240
|
-
|
241
|
-
def bar(word)
|
242
|
-
"You said #{word}!"
|
243
|
-
end
|
244
|
-
end
|
314
|
+
CLIPS::Environment.set_current_module(env, defmodule)
|
315
|
+
env.set_current_module(defmodule)
|
316
|
+
```
|
245
317
|
|
246
|
-
|
247
|
-
|
318
|
+
#### `CLIPS::Environment.find_defrule` / `CLIPS::Environment#find_defrule`
|
319
|
+
|
320
|
+
Finds a defrule by name and returns a CLIPS::Environment::Defrule object
|
321
|
+
|
322
|
+
```ruby
|
323
|
+
CLIPS::Environment.find_defrule(:a)
|
324
|
+
env.find_defrule("foo")
|
248
325
|
```
|
249
326
|
|
250
|
-
|
251
|
-
### `CLIPS::Environment#run`
|
327
|
+
#### `CLIPS::Environment.find_instance` / `CLIPS::Environment#find_instance`
|
252
328
|
|
253
|
-
|
254
|
-
|
329
|
+
Finds an instance by name and returns a CLIPS::Environment::Instance object.
|
330
|
+
Can take an optional second and third argument for Defmodule or Demodule name
|
331
|
+
and a boolean that represents whether or not the instance should be searched for
|
332
|
+
in imported modules.
|
333
|
+
If the second argument is `nil`, `find_instance` will search the current module only.
|
255
334
|
|
256
335
|
```ruby
|
257
|
-
CLIPS::Environment.
|
258
|
-
|
259
|
-
|
260
|
-
env.
|
336
|
+
CLIPS::Environment.find_definstance(:a)
|
337
|
+
env.find_definstance("foo")
|
338
|
+
CLIPS::Environment.find_definstance(:a, :my_module)
|
339
|
+
env.find_definstance("foo", "my_module")
|
340
|
+
CLIPS::Environment.find_definstance(:a, :my_module, true)
|
341
|
+
env.find_definstance("foo", nil, true)
|
261
342
|
```
|
262
343
|
|
263
|
-
|
264
|
-
### `CLIPS::Environment#clear`
|
344
|
+
#### `CLIPS::Environment.find_defmodule` / `CLIPS::Environment#find_defmodule`
|
265
345
|
|
266
|
-
|
346
|
+
Finds a defmodule by name and returns a CLIPS::Environment::Defmodule object
|
267
347
|
|
268
348
|
```ruby
|
269
|
-
CLIPS::Environment.
|
270
|
-
env.
|
349
|
+
CLIPS::Environment.find_defmodule(:a)
|
350
|
+
env.find_defmodule("foo")
|
271
351
|
```
|
272
352
|
|
273
|
-
|
274
|
-
### `CLIPS::Environment#reset`
|
353
|
+
#### `CLIPS::Environment.get_defclass_list` / `CLIPS::Environment#get_defclass_list`
|
275
354
|
|
276
|
-
|
277
|
-
|
278
|
-
|
355
|
+
Return an array of Defclass names as symbols in the environment. Pass an argument of a
|
356
|
+
symbol, string, or Defmodule object in order to only get Defclasss
|
357
|
+
in that Defmodule. If you do not, it will return all Defclass names in all modules.
|
279
358
|
|
280
359
|
```ruby
|
281
|
-
CLIPS::Environment.
|
282
|
-
env.
|
360
|
+
CLIPS::Environment.get_defclass_list(env)
|
361
|
+
env.get_defclass_list
|
362
|
+
CLIPS::Environment.get_defclass_list(env, :MAIN)
|
363
|
+
env.get_defclass_list(:MAIN)
|
364
|
+
CLIPS::Environment.get_defclass_list(env, defmodule)
|
365
|
+
env.get_defclass_list(defmodule)
|
283
366
|
```
|
284
367
|
|
285
|
-
|
286
|
-
### `CLIPS::Environment#facts`
|
368
|
+
#### `CLIPS::Environment.get_instance_list` / `CLIPS::Environment#get_instance_list`
|
287
369
|
|
288
|
-
|
370
|
+
Return an array of Instances in the environment. Pass an argument of a
|
371
|
+
symbol, string, or Defclass object in order to only get Instances
|
372
|
+
in that Defclass. If you do not, it will return all Instances of all Defclasses.
|
373
|
+
If you do, you may also pass `true` as the second argument
|
374
|
+
to include instances of subclasses of this Defclass.
|
289
375
|
|
290
376
|
```ruby
|
291
|
-
CLIPS::Environment.
|
292
|
-
env.
|
377
|
+
CLIPS::Environment.get_instance_list(env)
|
378
|
+
env.get_instance_list
|
379
|
+
CLIPS::Environment.get_instance_list(env, :foo_class)
|
380
|
+
env.get_instance_list(:"my-class")
|
381
|
+
CLIPS::Environment.get_instance_list(env, defclass)
|
382
|
+
env.get_instance_list(defclass)
|
383
|
+
CLIPS::Environment.get_instance_list(env, defclass, true)
|
384
|
+
env.get_instance_list(defclass, true)
|
293
385
|
```
|
294
386
|
|
295
|
-
|
296
|
-
### `CLIPS::Environment#get_current_module`
|
387
|
+
#### `CLIPS::Environment.get_deftemplate_list` / `CLIPS::Environment#get_deftemplate_list`
|
297
388
|
|
298
|
-
|
389
|
+
Return an array of Deftemplate names as symbols in the environment. Pass an argument of a
|
390
|
+
symbol, string, or Defmodule object in order to only get Deftemplates
|
391
|
+
in that Defmodule. If you do not, it will return all Deftemplate names in all modules.
|
299
392
|
|
300
393
|
```ruby
|
301
|
-
CLIPS::Environment.
|
302
|
-
env.
|
394
|
+
CLIPS::Environment.get_deftemplate_list(env)
|
395
|
+
env.get_deftemplate_list
|
396
|
+
CLIPS::Environment.get_deftemplate_list(env, :MAIN)
|
397
|
+
env.get_deftemplate_list(:MAIN)
|
398
|
+
CLIPS::Environment.get_deftemplate_list(env, defmodule)
|
399
|
+
env.get_deftemplate_list(defmodule)
|
303
400
|
```
|
304
401
|
|
305
|
-
|
306
|
-
### `CLIPS::Environment#set_current_module`
|
402
|
+
#### `CLIPS::Environment.get_defrule_list` / `CLIPS::Environment#get_defrule_list`
|
307
403
|
|
308
|
-
|
404
|
+
Return an array of Defrule names as symbols in the environment. Pass an argument of a
|
405
|
+
symbol, string, or Defmodule object in order to only get Defrules
|
406
|
+
in that Defmodule. If you do not, it will return all Defrule names in all modules.
|
309
407
|
|
310
408
|
```ruby
|
311
|
-
CLIPS::Environment.
|
312
|
-
env.
|
409
|
+
CLIPS::Environment.get_defrule_list(env)
|
410
|
+
env.get_defrule_list
|
411
|
+
CLIPS::Environment.get_defrule_list(env, :MAIN)
|
412
|
+
env.get_defrule_list(:MAIN)
|
413
|
+
CLIPS::Environment.get_defrule_list(env, defmodule)
|
414
|
+
env.get_defrule_list(defmodule)
|
313
415
|
```
|
314
416
|
|
315
|
-
|
316
|
-
|
417
|
+
#### `CLIPS::Environment.get_defmodule_list` / `CLIPS::Environment#get_defmodule_list`
|
418
|
+
|
419
|
+
Return an array of Defmodule names as symbols in the environment.
|
420
|
+
|
421
|
+
```ruby
|
422
|
+
CLIPS::Environment.get_defmodule_list(env)
|
423
|
+
env.get_defmodule_list
|
424
|
+
```
|
425
|
+
|
426
|
+
#### `CLIPS::Environment.find_deftemplate` / `CLIPS::Environment#find_deftemplate`
|
427
|
+
|
428
|
+
Finds a deftemplate by name and returns a CLIPS::Environment::Deftemplate object
|
429
|
+
|
430
|
+
```ruby
|
431
|
+
CLIPS::Environment.find_deftemplate(:a)
|
432
|
+
env.find_deftemplate("foo")
|
433
|
+
```
|
434
|
+
|
435
|
+
#### `CLIPS::Environment.find_defclass` / `CLIPS::Environment#find_defclass`
|
436
|
+
|
437
|
+
Finds a defclass by name and returns a CLIPS::Environment::Defclass object
|
438
|
+
|
439
|
+
```ruby
|
440
|
+
CLIPS::Environment.find_defclass(:a)
|
441
|
+
env.find_defclass("foo")
|
442
|
+
```
|
443
|
+
|
444
|
+
#### `CLIPS::Environment.watch` / `env.watch`
|
445
|
+
#### `CLIPS::Environment.unwatch` / `env.unwatch`
|
446
|
+
|
447
|
+
"Watch" or "Unwatch" a specific thing that happens in the CLIPS environment.
|
448
|
+
There are several things that may be watched (or unwatched) such that CLIPS will
|
449
|
+
report debugging information to `STDOUT`. This gem provides two ways to watch
|
450
|
+
or unwatch a debug item: either pass the watch item as a symbol to `watch` or
|
451
|
+
`unwatch`, or use the corresponding `watch_foo` or `unwatch_foo` methods where
|
452
|
+
`foo` is replaced by the watch item (as listed):
|
453
|
+
|
454
|
+
```ruby
|
455
|
+
:all
|
456
|
+
:facts
|
457
|
+
:instances
|
458
|
+
:slots
|
459
|
+
:rules
|
460
|
+
:activations
|
461
|
+
:messages
|
462
|
+
:message_handlers
|
463
|
+
:generic_functions
|
464
|
+
:methods
|
465
|
+
:deffunctions
|
466
|
+
:compilations
|
467
|
+
:statistics
|
468
|
+
:globals
|
469
|
+
:focus
|
470
|
+
```
|
471
|
+
|
472
|
+
```ruby
|
473
|
+
CLIPS::Environment.watch_facts
|
474
|
+
env.watch_statistics
|
475
|
+
CLIPS::Environment.unwatch(:facts)
|
476
|
+
env.unwatch(:statistics)
|
477
|
+
```
|
478
|
+
|
479
|
+
### Fact Methods
|
480
|
+
|
481
|
+
#### `CLIPS::Environment::Fact.pp_form` / `CLIPS::Environment::Fact#pp_form`
|
317
482
|
|
318
483
|
Returns a pretty printed string representation of the Fact
|
319
484
|
|
@@ -322,8 +487,7 @@ CLIPS::Environment::Fact.pp_form(fact)
|
|
322
487
|
fact.pp_form
|
323
488
|
```
|
324
489
|
|
325
|
-
|
326
|
-
### `CLIPS::Environment::Fact#existp`
|
490
|
+
#### `CLIPS::Environment::Fact.existp` / `CLIPS::Environment::Fact#existp`
|
327
491
|
|
328
492
|
Returns a boolean representing whether or not a Fact has been retracted
|
329
493
|
|
@@ -332,8 +496,7 @@ CLIPS::Environment::Fact.existp(fact)
|
|
332
496
|
fact.existp
|
333
497
|
```
|
334
498
|
|
335
|
-
|
336
|
-
### `CLIPS::Environment::Fact#to_h`
|
499
|
+
#### `CLIPS::Environment::Fact.to_h` / `CLIPS::Environment::Fact#to_h`
|
337
500
|
|
338
501
|
Returns a hash representing the fact slot names and their values
|
339
502
|
|
@@ -342,8 +505,7 @@ CLIPS::Environment::Fact.to_h(fact)
|
|
342
505
|
fact.to_h
|
343
506
|
```
|
344
507
|
|
345
|
-
|
346
|
-
### `CLIPS::Environment::Fact#index`
|
508
|
+
#### `CLIPS::Environment::Fact.index` / `CLIPS::Environment::Fact#index`
|
347
509
|
|
348
510
|
Returns the index of the fact in working memory
|
349
511
|
|
@@ -352,8 +514,7 @@ CLIPS::Environment::Fact.index(fact)
|
|
352
514
|
fact.index
|
353
515
|
```
|
354
516
|
|
355
|
-
|
356
|
-
### `CLIPS::Environment::Fact#deftemplate`
|
517
|
+
#### `CLIPS::Environment::Fact.deftemplate` / `CLIPS::Environment::Fact#deftemplate`
|
357
518
|
|
358
519
|
Returns the Deftemplate object for a fact
|
359
520
|
|
@@ -362,8 +523,7 @@ CLIPS::Environment::Fact.deftemplate(fact)
|
|
362
523
|
fact.deftemplate
|
363
524
|
```
|
364
525
|
|
365
|
-
|
366
|
-
### `CLIPS::Environment::Fact#deftemplate_name`
|
526
|
+
#### `CLIPS::Environment::Fact.deftemplate_name` / `CLIPS::Environment::Fact#deftemplate_name`
|
367
527
|
|
368
528
|
Returns the name of the Deftemplate for a fact as a symbol
|
369
529
|
|
@@ -372,8 +532,7 @@ CLIPS::Environment::Fact.deftemplate_name(fact)
|
|
372
532
|
fact.deftemplate_name
|
373
533
|
```
|
374
534
|
|
375
|
-
|
376
|
-
### `CLIPS::Environment::Fact#slot_names`
|
535
|
+
#### `CLIPS::Environment::Fact.slot_names` / `CLIPS::Environment::Fact#slot_names`
|
377
536
|
|
378
537
|
Returns an array representing the slot names of a fact
|
379
538
|
|
@@ -382,8 +541,7 @@ CLIPS::Environment::Fact.slot_names(fact)
|
|
382
541
|
fact.slot_names
|
383
542
|
```
|
384
543
|
|
385
|
-
|
386
|
-
### `CLIPS::Environment::Fact#get_slot`
|
544
|
+
#### `CLIPS::Environment::Fact.get_slot` / `CLIPS::Environment::Fact#get_slot`
|
387
545
|
|
388
546
|
Gets the value stored in the specified slot of a fact.
|
389
547
|
Can either pass a string or symbol for the slot name argument.
|
@@ -393,8 +551,7 @@ CLIPS::Environment::Fact.get_slot(fact, 'bar')
|
|
393
551
|
fact.get_slot(:foo)
|
394
552
|
```
|
395
553
|
|
396
|
-
|
397
|
-
### `CLIPS::Environment::Fact#retract`
|
554
|
+
#### `CLIPS::Environment::Fact.retract` / `CLIPS::Environment::Fact#retract`
|
398
555
|
|
399
556
|
Retracts a fact from the environment.
|
400
557
|
|
@@ -403,8 +560,7 @@ CLIPS::Environment::Fact.retract(fact)
|
|
403
560
|
fact.retract
|
404
561
|
```
|
405
562
|
|
406
|
-
|
407
|
-
### `CLIPS::Environment::Fact#modify`
|
563
|
+
#### `CLIPS::Environment::Fact.modify` / `CLIPS::Environment::Fact#modify`
|
408
564
|
|
409
565
|
Modifies a non-implicit deftemplate fact from the environment.
|
410
566
|
Will not work with non-deftemplate facts!
|
@@ -414,8 +570,9 @@ CLIPS::Environment::Fact.modify(fact, bar: 123)
|
|
414
570
|
fact.modify(foo: "my new foo!")
|
415
571
|
```
|
416
572
|
|
417
|
-
###
|
418
|
-
|
573
|
+
### Instance Methods
|
574
|
+
|
575
|
+
#### `CLIPS::Environment::Instance.unmake` / `CLIPS::Environment::Instance#unmake`
|
419
576
|
|
420
577
|
Unmakes an instance in the environment, deleting it.
|
421
578
|
|
@@ -424,8 +581,7 @@ CLIPS::Environment::Instance.unmake(instance)
|
|
424
581
|
instance.unmake
|
425
582
|
```
|
426
583
|
|
427
|
-
|
428
|
-
### `CLIPS::Environment::Instance#delete`
|
584
|
+
#### `CLIPS::Environment::Instance.delete` / `CLIPS::Environment::Instance#delete`
|
429
585
|
|
430
586
|
Deletes an instance in the environment.
|
431
587
|
|
@@ -434,8 +590,7 @@ CLIPS::Environment::Instance.delete(instance)
|
|
434
590
|
instance.delete
|
435
591
|
```
|
436
592
|
|
437
|
-
|
438
|
-
### `CLIPS::Environment::Instance#name`
|
593
|
+
#### `CLIPS::Environment::Instance.name` / `CLIPS::Environment::Instance#name`
|
439
594
|
|
440
595
|
Returns the name of an Instance as a symbol
|
441
596
|
|
@@ -444,8 +599,7 @@ CLIPS::Environment::Instance.name(instance)
|
|
444
599
|
instance.name
|
445
600
|
```
|
446
601
|
|
447
|
-
|
448
|
-
### `CLIPS::Environment::Instance#pp_form`
|
602
|
+
#### `CLIPS::Environment::Instance.pp_form` / `CLIPS::Environment::Instance#pp_form`
|
449
603
|
|
450
604
|
Returns a pretty printed string representation of an Instance
|
451
605
|
|
@@ -454,8 +608,7 @@ CLIPS::Environment::Instance.pp_form(instance)
|
|
454
608
|
instance.pp_form
|
455
609
|
```
|
456
610
|
|
457
|
-
|
458
|
-
### `CLIPS::Environment::Instance#defclass`
|
611
|
+
#### `CLIPS::Environment::Instance.defclass` / `CLIPS::Environment::Instance#defclass`
|
459
612
|
|
460
613
|
Returns the Defclass of an Instance
|
461
614
|
|
@@ -464,8 +617,7 @@ CLIPS::Environment::Instance.defclass(instance)
|
|
464
617
|
instance.defclass
|
465
618
|
```
|
466
619
|
|
467
|
-
|
468
|
-
### `CLIPS::Environment::Instance#to_h`
|
620
|
+
#### `CLIPS::Environment::Instance.to_h` / `CLIPS::Environment::Instance#to_h`
|
469
621
|
|
470
622
|
Returns a hash representing the instance slot names and their values.
|
471
623
|
Pass a `true` as an argument to get inhereted slots as well.
|
@@ -477,8 +629,9 @@ CLIPS::Environment::Instance.to_h(instance, true)
|
|
477
629
|
instance.to_h(true)
|
478
630
|
```
|
479
631
|
|
480
|
-
###
|
481
|
-
|
632
|
+
### Defclass Methods
|
633
|
+
|
634
|
+
#### `CLIPS::Environment::Defclass.name` / `CLIPS::Environment::Defclass#name`
|
482
635
|
|
483
636
|
Returns the name of an Defclass as a symbol
|
484
637
|
|
@@ -487,8 +640,7 @@ CLIPS::Environment::Defclass.name(defclass)
|
|
487
640
|
defclass.name
|
488
641
|
```
|
489
642
|
|
490
|
-
|
491
|
-
### `CLIPS::Environment::Defclass#pp_form`
|
643
|
+
#### `CLIPS::Environment::Defclass.pp_form` / `CLIPS::Environment::Defclass#pp_form`
|
492
644
|
|
493
645
|
Returns a pretty printed string representation of an Defclass
|
494
646
|
|
@@ -497,8 +649,7 @@ CLIPS::Environment::Defclass.pp_form(defclass)
|
|
497
649
|
defclass.pp_form
|
498
650
|
```
|
499
651
|
|
500
|
-
|
501
|
-
### `CLIPS::Environment::Defclass#slots`
|
652
|
+
#### `CLIPS::Environment::Defclass.slots` / `CLIPS::Environment::Defclass#slots`
|
502
653
|
|
503
654
|
Returns an array representing the slot names of a Defclass.
|
504
655
|
Pass `true` as an argument to get inherited slots, as well.
|
@@ -510,8 +661,7 @@ CLIPS::Environment::Defclass.slots(defclass, true)
|
|
510
661
|
defclass.slots(true)
|
511
662
|
```
|
512
663
|
|
513
|
-
|
514
|
-
### `CLIPS::Environment::Defclass#defmodule_name`
|
664
|
+
#### `CLIPS::Environment::Defclass.defmodule_name` / `CLIPS::Environment::Defclass#defmodule_name`
|
515
665
|
|
516
666
|
Returns the name of the defmodule in which the defclass is defined
|
517
667
|
|
@@ -520,8 +670,7 @@ CLIPS::Environment::Defclass.defmodule_name(defclass)
|
|
520
670
|
defclass.defmodule_name
|
521
671
|
```
|
522
672
|
|
523
|
-
|
524
|
-
### `CLIPS::Environment::Defclass#defmodule`
|
673
|
+
#### `CLIPS::Environment::Defclass.defmodule` / `CLIPS::Environment::Defclass#defmodule`
|
525
674
|
|
526
675
|
Returns the defmodule in which the defclass is defined
|
527
676
|
|
@@ -530,8 +679,7 @@ CLIPS::Environment::Defclass.defmodule(defclass)
|
|
530
679
|
defclass.defmodule
|
531
680
|
```
|
532
681
|
|
533
|
-
|
534
|
-
### `CLIPS::Environment::Defclass#get_instance_list`
|
682
|
+
#### `CLIPS::Environment::Defclass.get_instance_list` / `CLIPS::Environment::Defclass#get_instance_list`
|
535
683
|
|
536
684
|
Return an array of Instances of the Defclass.
|
537
685
|
Pass `true` as an argument to include instances of subclasses
|
@@ -544,8 +692,7 @@ defclass.get_instance_list
|
|
544
692
|
defclass.get_instance_list(true)
|
545
693
|
```
|
546
694
|
|
547
|
-
|
548
|
-
### `CLIPS::Environment::Defclass#superclasses`
|
695
|
+
#### `CLIPS::Environment::Defclass.superclasses` / `CLIPS::Environment::Defclass#superclasses`
|
549
696
|
|
550
697
|
Return an array of superclasses of the Defclass.
|
551
698
|
Pass `true` as an argument to include inherited superclasses.
|
@@ -557,8 +704,7 @@ defclass.superclasses
|
|
557
704
|
defclass.superclasses(true)
|
558
705
|
```
|
559
706
|
|
560
|
-
|
561
|
-
### `CLIPS::Environment::Defclass#subclasses`
|
707
|
+
#### `CLIPS::Environment::Defclass.subclasses` / `CLIPS::Environment::Defclass#subclasses`
|
562
708
|
|
563
709
|
Return an array of subclasses of the Defclass.
|
564
710
|
Pass `true` as an argument to include inherited subclasses.
|
@@ -570,36 +716,9 @@ defclass.subclasses
|
|
570
716
|
defclass.subclasses(true)
|
571
717
|
```
|
572
718
|
|
573
|
-
###
|
574
|
-
### `CLIPS::Environment#find_defrule`
|
575
|
-
|
576
|
-
Finds a defrule by name and returns a CLIPS::Environment::Defrule object
|
577
|
-
|
578
|
-
```ruby
|
579
|
-
CLIPS::Environment.find_defrule(:a)
|
580
|
-
env.find_defrule("foo")
|
581
|
-
```
|
582
|
-
|
583
|
-
### `CLIPS::Environment.find_instance`
|
584
|
-
### `CLIPS::Environment#find_instance`
|
719
|
+
### Defrule Methods
|
585
720
|
|
586
|
-
|
587
|
-
Can take an optional second and third argument for Defmodule or Demodule name
|
588
|
-
and a boolean that represents whether or not the instance should be searched for
|
589
|
-
in imported modules.
|
590
|
-
If the second argument is `nil`, `find_instance` will search the current module only.
|
591
|
-
|
592
|
-
```ruby
|
593
|
-
CLIPS::Environment.find_definstance(:a)
|
594
|
-
env.find_definstance("foo")
|
595
|
-
CLIPS::Environment.find_definstance(:a, :my_module)
|
596
|
-
env.find_definstance("foo", "my_module")
|
597
|
-
CLIPS::Environment.find_definstance(:a, :my_module, true)
|
598
|
-
env.find_definstance("foo", nil, true)
|
599
|
-
```
|
600
|
-
|
601
|
-
### `CLIPS::Environment::Defrule.name`
|
602
|
-
### `CLIPS::Environment::Defrule#name`
|
721
|
+
#### `CLIPS::Environment::Defrule.name` / `CLIPS::Environment::Defrule#name`
|
603
722
|
|
604
723
|
Returns the name of a defrule as a symbol
|
605
724
|
|
@@ -608,8 +727,7 @@ CLIPS::Environment::Defrule.name(defrule)
|
|
608
727
|
defrule.name
|
609
728
|
```
|
610
729
|
|
611
|
-
|
612
|
-
### `CLIPS::Environment::Defrule#defmodule_name`
|
730
|
+
#### `CLIPS::Environment::Defrule.defmodule_name` / `CLIPS::Environment::Defrule#defmodule_name`
|
613
731
|
|
614
732
|
Returns the name of the defmodule in which the defrule is defined
|
615
733
|
|
@@ -618,8 +736,7 @@ CLIPS::Environment::Defrule.defmodule_name(defrule)
|
|
618
736
|
defrule.defmodule_name
|
619
737
|
```
|
620
738
|
|
621
|
-
|
622
|
-
### `CLIPS::Environment::Defrule#defmodule`
|
739
|
+
#### `CLIPS::Environment::Defrule.defmodule` / `CLIPS::Environment::Defrule#defmodule`
|
623
740
|
|
624
741
|
Returns the defmodule in which the defrule is defined
|
625
742
|
|
@@ -628,8 +745,7 @@ CLIPS::Environment::Defrule.defmodule(defrule)
|
|
628
745
|
defrule.defmodule
|
629
746
|
```
|
630
747
|
|
631
|
-
|
632
|
-
### `CLIPS::Environment::Defrule#is_deletable`
|
748
|
+
#### `CLIPS::Environment::Defrule.is_deletable` / `CLIPS::Environment::Defrule#is_deletable`
|
633
749
|
|
634
750
|
Returns a boolean whether the Defrule is deletable or not
|
635
751
|
|
@@ -638,8 +754,7 @@ CLIPS::Environment::Defrule.is_deletable(defrule)
|
|
638
754
|
defrule.is_deletable
|
639
755
|
```
|
640
756
|
|
641
|
-
|
642
|
-
### `CLIPS::Environment::Defrule#pp_form`
|
757
|
+
#### `CLIPS::Environment::Defrule.pp_form` / `CLIPS::Environment::Defrule#pp_form`
|
643
758
|
|
644
759
|
Returns a pretty printed string representation of the Defrule
|
645
760
|
|
@@ -648,8 +763,7 @@ CLIPS::Environment::Defrule.pp_form(defrule)
|
|
648
763
|
defrule.pp_form
|
649
764
|
```
|
650
765
|
|
651
|
-
|
652
|
-
### `CLIPS::Environment::Defrule#has_breakpoint`
|
766
|
+
#### `CLIPS::Environment::Defrule.has_breakpoint` / `CLIPS::Environment::Defrule#has_breakpoint`
|
653
767
|
|
654
768
|
Returns whether or not the rule has a breakpoint set
|
655
769
|
|
@@ -658,8 +772,7 @@ CLIPS::Environment::Defrule.has_breakpoint(defrule)
|
|
658
772
|
defrule.has_breakpoint
|
659
773
|
```
|
660
774
|
|
661
|
-
|
662
|
-
### `CLIPS::Environment::Defrule#set_break`
|
775
|
+
#### `CLIPS::Environment::Defrule.set_break` / `CLIPS::Environment::Defrule#set_break`
|
663
776
|
|
664
777
|
Sets a breakpoint on a rule
|
665
778
|
|
@@ -668,8 +781,7 @@ CLIPS::Environment::Defrule.set_break(defrule)
|
|
668
781
|
defrule.set_break
|
669
782
|
```
|
670
783
|
|
671
|
-
|
672
|
-
### `CLIPS::Environment::Defrule#remove_break`
|
784
|
+
#### `CLIPS::Environment::Defrule.remove_break` / `CLIPS::Environment::Defrule#remove_break`
|
673
785
|
|
674
786
|
Returns whether or not it was able to remove a breakpoint from a rule
|
675
787
|
|
@@ -678,8 +790,7 @@ CLIPS::Environment::Defrule.remove_break(defrule)
|
|
678
790
|
defrule.remove_break
|
679
791
|
```
|
680
792
|
|
681
|
-
|
682
|
-
### `CLIPS::Environment::Defrule#salience`
|
793
|
+
#### `CLIPS::Environment::Defrule.salience` / `CLIPS::Environment::Defrule#salience`
|
683
794
|
|
684
795
|
Returns the salience of a defrule
|
685
796
|
|
@@ -688,18 +799,9 @@ CLIPS::Environment::Defrule.salience(defrule)
|
|
688
799
|
defrule.salience
|
689
800
|
```
|
690
801
|
|
691
|
-
###
|
692
|
-
### `CLIPS::Environment#find_defmodule`
|
693
|
-
|
694
|
-
Finds a defmodule by name and returns a CLIPS::Environment::Defmodule object
|
695
|
-
|
696
|
-
```ruby
|
697
|
-
CLIPS::Environment.find_defmodule(:a)
|
698
|
-
env.find_defmodule("foo")
|
699
|
-
```
|
802
|
+
### Defmodule Methods
|
700
803
|
|
701
|
-
|
702
|
-
### `CLIPS::Environment::Defmodule#name`
|
804
|
+
#### `CLIPS::Environment::Defmodule.name` / `CLIPS::Environment::Defmodule#name`
|
703
805
|
|
704
806
|
Returns the name of a defmodule as a symbol
|
705
807
|
|
@@ -708,8 +810,7 @@ CLIPS::Environment::Defmodule.name(defmodule)
|
|
708
810
|
defmodule.name
|
709
811
|
```
|
710
812
|
|
711
|
-
|
712
|
-
### `CLIPS::Environment::Defmodule#pp_form`
|
813
|
+
#### `CLIPS::Environment::Defmodule.pp_form` / `CLIPS::Environment::Defmodule#pp_form`
|
713
814
|
|
714
815
|
Returns a pretty printed string representation of the Defmodule
|
715
816
|
|
@@ -718,8 +819,7 @@ CLIPS::Environment::Defmodule.pp_form(defmodule)
|
|
718
819
|
defmodule.pp_form
|
719
820
|
```
|
720
821
|
|
721
|
-
|
722
|
-
### `CLIPS::Environment::Defmodule#set_current`
|
822
|
+
#### `CLIPS::Environment::Defmodule.set_current` / `CLIPS::Environment::Defmodule#set_current`
|
723
823
|
|
724
824
|
Sets the Defmodule as the current module of the environment
|
725
825
|
|
@@ -728,8 +828,7 @@ CLIPS::Environment::Defmodule.set_current(defmodule)
|
|
728
828
|
defmodule.set_current
|
729
829
|
```
|
730
830
|
|
731
|
-
|
732
|
-
### `CLIPS::Environment::Defmodule#get_fact_list`
|
831
|
+
#### `CLIPS::Environment::Defmodule.get_fact_list` / `CLIPS::Environment::Defmodule#get_fact_list`
|
733
832
|
|
734
833
|
Return an array of Facts with deftemplates in the Defmodule
|
735
834
|
|
@@ -738,8 +837,7 @@ CLIPS::Environment::Defmodule.get_fact_list(defmodule)
|
|
738
837
|
defmodule.get_fact_list
|
739
838
|
```
|
740
839
|
|
741
|
-
|
742
|
-
### `CLIPS::Environment::Defmodule#find_instance`
|
840
|
+
#### `CLIPS::Environment::Defmodule.find_instance` / `CLIPS::Environment::Defmodule#find_instance`
|
743
841
|
|
744
842
|
Finds an instance by name and returns a CLIPS::Environment::Instance object.
|
745
843
|
Can take an optional second argument
|
@@ -753,106 +851,36 @@ CLIPS::Environment::Defmodule.find_instance(:a, true)
|
|
753
851
|
defmodule.find_instance("foo", true)
|
754
852
|
```
|
755
853
|
|
756
|
-
|
757
|
-
### `CLIPS::Environment#get_defclass_list`
|
758
|
-
|
759
|
-
Return an array of Defclass names as symbols in the environment. Pass an argument of a
|
760
|
-
symbol, string, or Defmodule object in order to only get Defclasss
|
761
|
-
in that Defmodule. If you do not, it will return all Defclass names in all modules.
|
762
|
-
|
763
|
-
```ruby
|
764
|
-
CLIPS::Environment.get_defclass_list(env)
|
765
|
-
env.get_defclass_list
|
766
|
-
CLIPS::Environment.get_defclass_list(env, :MAIN)
|
767
|
-
env.get_defclass_list(:MAIN)
|
768
|
-
CLIPS::Environment.get_defclass_list(env, defmodule)
|
769
|
-
env.get_defclass_list(defmodule)
|
770
|
-
```
|
854
|
+
#### `CLIPS::Environment::Defmodule.get_defclass_list` / `CLIPS::Environment::Defmodule#get_defclass_list`
|
771
855
|
|
772
|
-
|
773
|
-
### `CLIPS::Environment#get_instance_list`
|
774
|
-
|
775
|
-
Return an array of Instances in the environment. Pass an argument of a
|
776
|
-
symbol, string, or Defclass object in order to only get Instances
|
777
|
-
in that Defclass. If you do not, it will return all Instances of all Defclasses.
|
778
|
-
If you do, you may also pass `true` as the second argument
|
779
|
-
to include instances of subclasses of this Defclass.
|
780
|
-
|
781
|
-
```ruby
|
782
|
-
CLIPS::Environment.get_instance_list(env)
|
783
|
-
env.get_instance_list
|
784
|
-
CLIPS::Environment.get_instance_list(env, :foo_class)
|
785
|
-
env.get_instance_list(:"my-class")
|
786
|
-
CLIPS::Environment.get_instance_list(env, defclass)
|
787
|
-
env.get_instance_list(defclass)
|
788
|
-
CLIPS::Environment.get_instance_list(env, defclass, true)
|
789
|
-
env.get_instance_list(defclass, true)
|
790
|
-
```
|
791
|
-
|
792
|
-
### `CLIPS::Environment.get_deftemplate_list`
|
793
|
-
### `CLIPS::Environment#get_deftemplate_list`
|
794
|
-
|
795
|
-
Return an array of Deftemplate names as symbols in the environment. Pass an argument of a
|
796
|
-
symbol, string, or Defmodule object in order to only get Deftemplates
|
797
|
-
in that Defmodule. If you do not, it will return all Deftemplate names in all modules.
|
798
|
-
|
799
|
-
```ruby
|
800
|
-
CLIPS::Environment.get_deftemplate_list(env)
|
801
|
-
env.get_deftemplate_list
|
802
|
-
CLIPS::Environment.get_deftemplate_list(env, :MAIN)
|
803
|
-
env.get_deftemplate_list(:MAIN)
|
804
|
-
CLIPS::Environment.get_deftemplate_list(env, defmodule)
|
805
|
-
env.get_deftemplate_list(defmodule)
|
806
|
-
```
|
807
|
-
|
808
|
-
### `CLIPS::Environment.get_defrule_list`
|
809
|
-
### `CLIPS::Environment#get_defrule_list`
|
810
|
-
|
811
|
-
Return an array of Defrule names as symbols in the environment. Pass an argument of a
|
812
|
-
symbol, string, or Defmodule object in order to only get Defrules
|
813
|
-
in that Defmodule. If you do not, it will return all Defrule names in all modules.
|
856
|
+
Return an array of Defclass names as symbols in the Defmodule
|
814
857
|
|
815
858
|
```ruby
|
816
|
-
CLIPS::Environment.
|
817
|
-
|
818
|
-
CLIPS::Environment.get_defrule_list(env, :MAIN)
|
819
|
-
env.get_defrule_list(:MAIN)
|
820
|
-
CLIPS::Environment.get_defrule_list(env, defmodule)
|
821
|
-
env.get_defrule_list(defmodule)
|
859
|
+
CLIPS::Environment::Defmodule.get_defclass_list(defmodule)
|
860
|
+
defmodule.get_defclass_list
|
822
861
|
```
|
823
862
|
|
824
|
-
|
825
|
-
### `CLIPS::Environment#get_defmodule_list`
|
863
|
+
#### `CLIPS::Environment::Defmodule.get_deftemplate_list` / `CLIPS::Environment::Defmodule#get_deftemplate_list`
|
826
864
|
|
827
|
-
Return an array of
|
865
|
+
Return an array of Deftemplate names as symbols in the Defmodule
|
828
866
|
|
829
867
|
```ruby
|
830
|
-
CLIPS::Environment.
|
831
|
-
|
868
|
+
CLIPS::Environment::Defmodule.get_deftemplate_list(defmodule)
|
869
|
+
defmodule.get_deftemplate_list
|
832
870
|
```
|
833
871
|
|
834
|
-
|
835
|
-
### `CLIPS::Environment#find_deftemplate`
|
872
|
+
#### `CLIPS::Environment::Defmodule.get_defrule_list` / `CLIPS::Environment::Defmodule#get_defrule_list`
|
836
873
|
|
837
|
-
|
874
|
+
Return an array of Defrule names as symbols in the Defmodule
|
838
875
|
|
839
876
|
```ruby
|
840
|
-
CLIPS::Environment.
|
841
|
-
|
877
|
+
CLIPS::Environment::Defmodule.get_defrule_list(defmodule)
|
878
|
+
defmodule.get_defrule_list
|
842
879
|
```
|
843
880
|
|
844
|
-
###
|
845
|
-
### `CLIPS::Environment#find_defclass`
|
846
|
-
|
847
|
-
Finds a defclass by name and returns a CLIPS::Environment::Defclass object
|
848
|
-
|
849
|
-
```ruby
|
850
|
-
CLIPS::Environment.find_defclass(:a)
|
851
|
-
env.find_defclass("foo")
|
852
|
-
```
|
881
|
+
### Deftemplate Methods
|
853
882
|
|
854
|
-
|
855
|
-
### `CLIPS::Environment::Deftemplate#name`
|
883
|
+
#### `CLIPS::Environment::Deftemplate.name` / `CLIPS::Environment::Deftemplate#name`
|
856
884
|
|
857
885
|
Returns the name of a deftemplate as a symbol
|
858
886
|
|
@@ -861,8 +889,7 @@ CLIPS::Environment::Deftemplate.name(deftemplate)
|
|
861
889
|
deftemplate.name
|
862
890
|
```
|
863
891
|
|
864
|
-
|
865
|
-
### `CLIPS::Environment::Deftemplate#pp_form`
|
892
|
+
#### `CLIPS::Environment::Deftemplate.pp_form` / `CLIPS::Environment::Deftemplate#pp_form`
|
866
893
|
|
867
894
|
Returns a pretty printed string representation of the Deftemplate
|
868
895
|
|
@@ -871,8 +898,7 @@ CLIPS::Environment::Deftemplate.pp_form(deftemplate)
|
|
871
898
|
deftemplate.pp_form
|
872
899
|
```
|
873
900
|
|
874
|
-
|
875
|
-
### `CLIPS::Environment::Deftemplate#assert_hash`
|
901
|
+
#### `CLIPS::Environment::Deftemplate.assert_hash` / `CLIPS::Environment::Deftemplate#assert_hash`
|
876
902
|
|
877
903
|
Asserts a hash in the clips environment that a Deftemplate is defined in.
|
878
904
|
Returns the Fact object that was just asserted
|
@@ -882,8 +908,7 @@ CLIPS::Environment::Deftemplate.assert_hash(deftemplate, foo: :bar)
|
|
882
908
|
deftemplate.assert_hash(foo: :bar)
|
883
909
|
```
|
884
910
|
|
885
|
-
|
886
|
-
### `CLIPS::Environment::Deftemplate#defmodule_name`
|
911
|
+
#### `CLIPS::Environment::Deftemplate.defmodule_name` / `CLIPS::Environment::Deftemplate#defmodule_name`
|
887
912
|
|
888
913
|
Returns the name of the defmodule in which the deftemplate is defined
|
889
914
|
|
@@ -892,8 +917,7 @@ CLIPS::Environment::Deftemplate.defmodule_name(deftemplate)
|
|
892
917
|
deftemplate.defmodule_name
|
893
918
|
```
|
894
919
|
|
895
|
-
|
896
|
-
### `CLIPS::Environment::Deftemplate#defmodule`
|
920
|
+
#### `CLIPS::Environment::Deftemplate.defmodule` / `CLIPS::Environment::Deftemplate#defmodule`
|
897
921
|
|
898
922
|
Returns the defmodule in which the deftemplate is defined
|
899
923
|
|
@@ -902,8 +926,7 @@ CLIPS::Environment::Deftemplate.defmodule(deftemplate)
|
|
902
926
|
deftemplate.defmodule
|
903
927
|
```
|
904
928
|
|
905
|
-
|
906
|
-
### `CLIPS::Environment::Deftemplate#slot_names`
|
929
|
+
#### `CLIPS::Environment::Deftemplate.slot_names` / `CLIPS::Environment::Deftemplate#slot_names`
|
907
930
|
|
908
931
|
Returns the slot names of a deftemplate as symbols
|
909
932
|
|
@@ -912,8 +935,7 @@ CLIPS::Environment::Deftemplate.slot_names(deftemplate)
|
|
912
935
|
deftemplate.slot_names
|
913
936
|
```
|
914
937
|
|
915
|
-
|
916
|
-
### `CLIPS::Environment::Deftemplate#is_deletable`
|
938
|
+
#### `CLIPS::Environment::Deftemplate.is_deletable` / `CLIPS::Environment::Deftemplate#is_deletable`
|
917
939
|
|
918
940
|
Returns a boolean whether the Deftemplate is deletable or not
|
919
941
|
|
@@ -922,8 +944,7 @@ CLIPS::Environment::Deftemplate.is_deletable(deftemplate)
|
|
922
944
|
deftemplate.is_deletable
|
923
945
|
```
|
924
946
|
|
925
|
-
|
926
|
-
### `CLIPS::Environment::Deftemplate#is_implied`
|
947
|
+
#### `CLIPS::Environment::Deftemplate.is_implied` / `CLIPS::Environment::Deftemplate#is_implied`
|
927
948
|
|
928
949
|
Returns a boolean whether the Deftemplate is implied or not.
|
929
950
|
If the fact is an ordered fact, the Deftemplate is implied.
|
@@ -934,8 +955,7 @@ CLIPS::Environment::Deftemplate.is_implied(deftemplate)
|
|
934
955
|
deftemplate.is_implied
|
935
956
|
```
|
936
957
|
|
937
|
-
|
938
|
-
### `CLIPS::Environment::Deftemplate#slot_allowed_values`
|
958
|
+
#### `CLIPS::Environment::Deftemplate.slot_allowed_values` / `CLIPS::Environment::Deftemplate#slot_allowed_values`
|
939
959
|
|
940
960
|
Returns the allowed values for the slot of a deftemplate as symbols
|
941
961
|
|
@@ -944,8 +964,7 @@ CLIPS::Environment::Deftemplate.slot_allowed_values(deftemplate, :foo)
|
|
944
964
|
deftemplate.slot_allowed_values('bar')
|
945
965
|
```
|
946
966
|
|
947
|
-
|
948
|
-
### `CLIPS::Environment::Deftemplate#slot_default_value`
|
967
|
+
#### `CLIPS::Environment::Deftemplate.slot_default_value` / `CLIPS::Environment::Deftemplate#slot_default_value`
|
949
968
|
|
950
969
|
Returns the default value(s) for the slot of a deftemplate as symbols
|
951
970
|
|
@@ -954,8 +973,7 @@ CLIPS::Environment::Deftemplate.slot_default_value(deftemplate, :foo)
|
|
954
973
|
deftemplate.slot_default_value('bar')
|
955
974
|
```
|
956
975
|
|
957
|
-
|
958
|
-
### `CLIPS::Environment::Deftemplate#slot_types`
|
976
|
+
#### `CLIPS::Environment::Deftemplate.slot_types` / `CLIPS::Environment::Deftemplate#slot_types`
|
959
977
|
|
960
978
|
Returns the slot type(s) for the named slot of a deftemplate as symbols.
|
961
979
|
Possible types are as follows:
|
@@ -979,8 +997,7 @@ CLIPS::Environment::Deftemplate.slot_types(deftemplate, :foo)
|
|
979
997
|
deftemplate.slot_types('bar')
|
980
998
|
```
|
981
999
|
|
982
|
-
|
983
|
-
### `CLIPS::Environment::Deftemplate#slot_range`
|
1000
|
+
#### `CLIPS::Environment::Deftemplate.slot_range` / `CLIPS::Environment::Deftemplate#slot_range`
|
984
1001
|
|
985
1002
|
Returns the range of a named slot of a deftemplate as integers or symbols (in case of infinity).
|
986
1003
|
|
@@ -989,8 +1006,7 @@ CLIPS::Environment::Deftemplate.slot_range(deftemplate, :foo)
|
|
989
1006
|
deftemplate.slot_range('bar')
|
990
1007
|
```
|
991
1008
|
|
992
|
-
|
993
|
-
### `CLIPS::Environment::Deftemplate#slot_cardinality`
|
1009
|
+
#### `CLIPS::Environment::Deftemplate.slot_cardinality` / `CLIPS::Environment::Deftemplate#slot_cardinality`
|
994
1010
|
|
995
1011
|
Returns the cardinality of a named slot of a deftemplate as integers or symbols (in case of infinity).
|
996
1012
|
|
@@ -999,8 +1015,7 @@ CLIPS::Environment::Deftemplate.slot_cardinality(deftemplate, :foo)
|
|
999
1015
|
deftemplate.slot_cardinality('bar')
|
1000
1016
|
```
|
1001
1017
|
|
1002
|
-
|
1003
|
-
### `CLIPS::Environment::Deftemplate#slot_existp`
|
1018
|
+
#### `CLIPS::Environment::Deftemplate.slot_existp` / `CLIPS::Environment::Deftemplate#slot_existp`
|
1004
1019
|
|
1005
1020
|
Returns a boolean for whether or not the slot with a given name
|
1006
1021
|
exists on the Deftemplate.
|
@@ -1010,8 +1025,7 @@ CLIPS::Environment::Deftemplate.slot_existp(deftemplate, :foo)
|
|
1010
1025
|
deftemplate.slot_existp('bar')
|
1011
1026
|
```
|
1012
1027
|
|
1013
|
-
|
1014
|
-
### `CLIPS::Environment::Deftemplate#slot_singlep`
|
1028
|
+
#### `CLIPS::Environment::Deftemplate.slot_singlep` / `CLIPS::Environment::Deftemplate#slot_singlep`
|
1015
1029
|
|
1016
1030
|
Returns a boolean for whether or not the slot with a given name
|
1017
1031
|
on the Deftemplate is a single slot.
|
@@ -1021,8 +1035,7 @@ CLIPS::Environment::Deftemplate.slot_singlep(deftemplate, :foo)
|
|
1021
1035
|
deftemplate.slot_singlep('bar')
|
1022
1036
|
```
|
1023
1037
|
|
1024
|
-
|
1025
|
-
### `CLIPS::Environment::Deftemplate#slot_multip`
|
1038
|
+
#### `CLIPS::Environment::Deftemplate.slot_multip` / `CLIPS::Environment::Deftemplate#slot_multip`
|
1026
1039
|
|
1027
1040
|
Returns a boolean for whether or not the slot with a given name
|
1028
1041
|
on the Deftemplate is a multislot.
|
@@ -1032,8 +1045,7 @@ CLIPS::Environment::Deftemplate.slot_multip(deftemplate, :foo)
|
|
1032
1045
|
deftemplate.slot_multip('bar')
|
1033
1046
|
```
|
1034
1047
|
|
1035
|
-
|
1036
|
-
### `CLIPS::Environment::Deftemplate#slot_defaultp`
|
1048
|
+
#### `CLIPS::Environment::Deftemplate.slot_defaultp` / `CLIPS::Environment::Deftemplate#slot_defaultp`
|
1037
1049
|
|
1038
1050
|
Returns a symbol representing the type of default value a slot has
|
1039
1051
|
on the Deftemplate. Possible return values are as follows:
|
@@ -1049,38 +1061,7 @@ CLIPS::Environment::Deftemplate.slot_defaultp(deftemplate, :foo)
|
|
1049
1061
|
deftemplate.slot_defaultp('bar')
|
1050
1062
|
```
|
1051
1063
|
|
1052
|
-
|
1053
|
-
### `CLIPS::Environment::Defmodule#get_defclass_list`
|
1054
|
-
|
1055
|
-
Return an array of Defclass names as symbols in the Defmodule
|
1056
|
-
|
1057
|
-
```ruby
|
1058
|
-
CLIPS::Environment::Defmodule.get_defclass_list(defmodule)
|
1059
|
-
defmodule.get_defclass_list
|
1060
|
-
```
|
1061
|
-
|
1062
|
-
### `CLIPS::Environment::Defmodule.get_deftemplate_list`
|
1063
|
-
### `CLIPS::Environment::Defmodule#get_deftemplate_list`
|
1064
|
-
|
1065
|
-
Return an array of Deftemplate names as symbols in the Defmodule
|
1066
|
-
|
1067
|
-
```ruby
|
1068
|
-
CLIPS::Environment::Defmodule.get_deftemplate_list(defmodule)
|
1069
|
-
defmodule.get_deftemplate_list
|
1070
|
-
```
|
1071
|
-
|
1072
|
-
### `CLIPS::Environment::Defmodule.get_defrule_list`
|
1073
|
-
### `CLIPS::Environment::Defmodule#get_defrule_list`
|
1074
|
-
|
1075
|
-
Return an array of Defrule names as symbols in the Defmodule
|
1076
|
-
|
1077
|
-
```ruby
|
1078
|
-
CLIPS::Environment::Defmodule.get_defrule_list(defmodule)
|
1079
|
-
defmodule.get_defrule_list
|
1080
|
-
```
|
1081
|
-
|
1082
|
-
### `CLIPS::Environment.find_deffacts`
|
1083
|
-
### `CLIPS::Environment#find_deffacts`
|
1064
|
+
#### `CLIPS::Environment.find_deffacts` / `CLIPS::Environment#find_deffacts`
|
1084
1065
|
|
1085
1066
|
Finds a deffacts by name and returns a CLIPS::Environment::Deffacts object
|
1086
1067
|
|
@@ -1089,8 +1070,9 @@ CLIPS::Environment.find_deffacts(:a)
|
|
1089
1070
|
env.find_deffacts("foo")
|
1090
1071
|
```
|
1091
1072
|
|
1092
|
-
###
|
1093
|
-
|
1073
|
+
### Deffacts Methods
|
1074
|
+
|
1075
|
+
#### `CLIPS::Environment::Deffacts.name` / `CLIPS::Environment::Deffacts#name`
|
1094
1076
|
|
1095
1077
|
Returns the name of a deffacts as a symbol
|
1096
1078
|
|
@@ -1099,8 +1081,7 @@ CLIPS::Environment::Deffacts.name(deffacts)
|
|
1099
1081
|
deffacts.name
|
1100
1082
|
```
|
1101
1083
|
|
1102
|
-
|
1103
|
-
### `CLIPS::Environment::Deffacts#pp_form`
|
1084
|
+
#### `CLIPS::Environment::Deffacts.pp_form` / `CLIPS::Environment::Deffacts#pp_form`
|
1104
1085
|
|
1105
1086
|
Returns a pretty printed string representation of the Deffacts
|
1106
1087
|
|
@@ -1109,54 +1090,6 @@ CLIPS::Environment::Deffacts.pp_form(deffacts)
|
|
1109
1090
|
deffacts.pp_form
|
1110
1091
|
```
|
1111
1092
|
|
1112
|
-
### `CLIPS::Environment.watch`
|
1113
|
-
### `env.watch`
|
1114
|
-
### `CLIPS::Environment.unwatch`
|
1115
|
-
### `env.unwatch`
|
1116
|
-
|
1117
|
-
"Watch" or "Unwatch" a specific thing that happens in the CLIPS environment.
|
1118
|
-
There are several things that may be watched (or unwatched) such that CLIPS will
|
1119
|
-
report debugging information to `STDOUT`. This gem provides two ways to watch
|
1120
|
-
or unwatch a debug item: either pass the watch item as a symbol to `watch` or
|
1121
|
-
`unwatch`, or use the corresponding `watch_foo` or `unwatch_foo` methods where
|
1122
|
-
`foo` is replaced by the watch item (as listed):
|
1123
|
-
|
1124
|
-
```ruby
|
1125
|
-
:all
|
1126
|
-
:facts
|
1127
|
-
:instances
|
1128
|
-
:slots
|
1129
|
-
:rules
|
1130
|
-
:activations
|
1131
|
-
:messages
|
1132
|
-
:message_handlers
|
1133
|
-
:generic_functions
|
1134
|
-
:methods
|
1135
|
-
:deffunctions
|
1136
|
-
:compilations
|
1137
|
-
:statistics
|
1138
|
-
:globals
|
1139
|
-
:focus
|
1140
|
-
```
|
1141
|
-
|
1142
|
-
```ruby
|
1143
|
-
CLIPS::Environment.watch_facts
|
1144
|
-
env.watch_statistics
|
1145
|
-
CLIPS::Environment.unwatch(:facts)
|
1146
|
-
env.unwatch(:statistics)
|
1147
|
-
```
|
1148
|
-
|
1149
|
-
### `CLIPS::Environment.get_watch_state`
|
1150
|
-
### `env.get_watch_state`
|
1151
|
-
|
1152
|
-
Returns a bool representing whether or not the given debug item
|
1153
|
-
is currently being watched in the environment.
|
1154
|
-
|
1155
|
-
```ruby
|
1156
|
-
CLIPS::Environment.get_watch_state(env, :facts)
|
1157
|
-
env.get_watch_state(:methods)
|
1158
|
-
```
|
1159
|
-
|
1160
1093
|
## Running the tests
|
1161
1094
|
|
1162
1095
|
Simply do `rake compile` and then `rake test` in order to run the tests.
|