clipsruby 0.0.39 → 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +359 -400
  3. data/ext/clipsruby/clipsruby.c +420 -31
  4. 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
- ### `CLIPS.create_environment`
21
- ### `CLIPS::Environment.new`
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
- ### `CLIPS::Environment.batch_star`
32
- ### `env.batch_star`
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
- ### `CLIPS::Environment.save`
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
- ### `CLIPS::Environment.load`
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
- ### `CLIPS::Environment.save_facts`
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
- ### `CLIPS::Environment.load_facts`
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
- ### `CLIPS::Environment.bsave`
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
- ### `CLIPS::Environment.bload`
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
- ### `CLIPS::Environment.bsave_facts`
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
- ### `CLIPS::Environment.bload_facts`
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
- ### `CLIPS::Environment.assert_string`
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
- ### `CLIPS::Environment.assert_hash`
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
- ### `CLIPS::Environment.make_instance`
159
- ### `CLIPS::Environment#make_instance`
217
+ #### `CLIPS::Environment.make_instance` / `CLIPS::Environment#make_instance`
218
+
219
+ Make an Instance in the CLIPS environment.
220
+
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
160
226
 
161
- Make a string as an Instance in the CLIPS environment.
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
- ### `CLIPS::Environment.find_fact`
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
- ### `CLIPS::Environment.get_fact_list`
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
- ### `CLIPS::Environment.find_all_facts`
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
- ### `CLIPS::Environment._eval`
211
- ### `CLIPS::Environment#_eval`
291
+ #### `CLIPS::Environment.facts` / `CLIPS::Environment#facts`
212
292
 
213
- Evaluates a passed string in the CLIPS environment and returns the results.
293
+ Print all Facts defined in the CLIPS environment
214
294
 
215
295
  ```ruby
216
- CLIPS::Environment._eval(env, "(find-all-facts ((?f my_deftemplate)) TRUE)")
217
- env._eval("(find-all-facts ((?f my_deftemplate)) TRUE)")
296
+ CLIPS::Environment.facts(env)
297
+ env.facts
218
298
  ```
219
299
 
220
- ### `CLIPS::Environment.build`
221
- ### `CLIPS::Environment#build`
300
+ #### `CLIPS::Environment.get_current_module` / `CLIPS::Environment#get_current_module`
222
301
 
223
- Build the constructs in the env as defined in a string
302
+ Get the current module in the CLIPS environment
224
303
 
225
304
  ```ruby
226
- CLIPS::Environment.build(env, "(deftemplate my_template (slot a) (slot b) (slot c))")
227
- env.build("(defrule do-a-thing (my_template (a ?a)) => (println \"a: \" ?a))")
305
+ CLIPS::Environment.get_current_module(env)
306
+ env.get_current_module
228
307
  ```
229
308
 
230
- ### `CLIPS::Environment.add_udf`
231
- ### `CLIPS::Environment#add_udf`
309
+ #### `CLIPS::Environment.set_current_module` / `CLIPS::Environment#set_current_module`
232
310
 
233
- Adds a ruby method as a User Defined Function (udf) to the CLIPS environment
311
+ Set the current module in the CLIPS environment
234
312
 
235
313
  ```ruby
236
- class CLIPS::Environment
237
- def foo(a, b=2)
238
- a + b
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
- env.add_udf(:foo)
247
- CLIPS::Environment.add_udf(env, :bar)
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
- ### `CLIPS::Environment.run`
251
- ### `CLIPS::Environment#run`
327
+ #### `CLIPS::Environment.find_instance` / `CLIPS::Environment#find_instance`
252
328
 
253
- Runs the rules engine, executing items on the agenda.
254
- Optionally may take the number of items to run from the agenda as an argument.
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.run(env, 1)
258
- CLIPS::Environment.run(env)
259
- env.run(1)
260
- env.run
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
- ### `CLIPS::Environment.clear`
264
- ### `CLIPS::Environment#clear`
344
+ #### `CLIPS::Environment.find_defmodule` / `CLIPS::Environment#find_defmodule`
265
345
 
266
- Removes constructs and data from the environment.
346
+ Finds a defmodule by name and returns a CLIPS::Environment::Defmodule object
267
347
 
268
348
  ```ruby
269
- CLIPS::Environment.clear(env)
270
- env.clear
349
+ CLIPS::Environment.find_defmodule(:a)
350
+ env.find_defmodule("foo")
271
351
  ```
272
352
 
273
- ### `CLIPS::Environment.reset`
274
- ### `CLIPS::Environment#reset`
353
+ #### `CLIPS::Environment.get_defclass_list` / `CLIPS::Environment#get_defclass_list`
275
354
 
276
- Removes all facts and instances.
277
- Creates facts and instances defined in deffacts and definstances constructs.
278
- Resets the values of global variables in the specified environment.
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.reset(env)
282
- env.reset
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
- ### `CLIPS::Environment.facts`
286
- ### `CLIPS::Environment#facts`
368
+ #### `CLIPS::Environment.get_instance_list` / `CLIPS::Environment#get_instance_list`
287
369
 
288
- Print all Facts defined in the CLIPS environment
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.facts(env)
292
- env.facts
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
- ### `CLIPS::Environment.get_current_module`
296
- ### `CLIPS::Environment#get_current_module`
387
+ #### `CLIPS::Environment.get_deftemplate_list` / `CLIPS::Environment#get_deftemplate_list`
297
388
 
298
- Get the current module in the CLIPS environment
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.get_current_module(env)
302
- env.get_current_module
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
- ### `CLIPS::Environment.set_current_module`
306
- ### `CLIPS::Environment#set_current_module`
402
+ #### `CLIPS::Environment.get_defrule_list` / `CLIPS::Environment#get_defrule_list`
307
403
 
308
- Set the current module in the CLIPS environment
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.set_current_module(env, defmodule)
312
- env.set_current_module(defmodule)
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)
415
+ ```
416
+
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")
313
442
  ```
314
443
 
315
- ### `CLIPS::Environment::Fact.pp_form`
316
- ### `CLIPS::Environment::Fact#pp_form`
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
- ### `CLIPS::Environment::Fact.existp`
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
- ### `CLIPS::Environment::Fact.to_h`
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
- ### `CLIPS::Environment::Fact.index`
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
- ### `CLIPS::Environment::Fact.deftemplate`
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
- ### `CLIPS::Environment::Fact.deftemplate_name`
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
- ### `CLIPS::Environment::Fact.slot_names`
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
- ### `CLIPS::Environment::Fact.get_slot`
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
- ### `CLIPS::Environment::Fact.retract`
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
- ### `CLIPS::Environment::Fact.modify`
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
- ### `CLIPS::Environment::Instance.unmake`
418
- ### `CLIPS::Environment::Instance#unmake`
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
- ### `CLIPS::Environment::Instance.delete`
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
- ### `CLIPS::Environment::Instance.name`
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
- ### `CLIPS::Environment::Instance.pp_form`
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
- ### `CLIPS::Environment::Instance.defclass`
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,21 @@ CLIPS::Environment::Instance.defclass(instance)
464
617
  instance.defclass
465
618
  ```
466
619
 
467
- ### `CLIPS::Environment::Defclass.name`
468
- ### `CLIPS::Environment::Defclass#name`
620
+ #### `CLIPS::Environment::Instance.to_h` / `CLIPS::Environment::Instance#to_h`
621
+
622
+ Returns a hash representing the instance slot names and their values.
623
+ Pass a `true` as an argument to get inhereted slots as well.
624
+
625
+ ```ruby
626
+ CLIPS::Environment::Instance.to_h(instance)
627
+ instance.to_h
628
+ CLIPS::Environment::Instance.to_h(instance, true)
629
+ instance.to_h(true)
630
+ ```
631
+
632
+ ### Defclass Methods
633
+
634
+ #### `CLIPS::Environment::Defclass.name` / `CLIPS::Environment::Defclass#name`
469
635
 
470
636
  Returns the name of an Defclass as a symbol
471
637
 
@@ -474,8 +640,7 @@ CLIPS::Environment::Defclass.name(defclass)
474
640
  defclass.name
475
641
  ```
476
642
 
477
- ### `CLIPS::Environment::Defclass.pp_form`
478
- ### `CLIPS::Environment::Defclass#pp_form`
643
+ #### `CLIPS::Environment::Defclass.pp_form` / `CLIPS::Environment::Defclass#pp_form`
479
644
 
480
645
  Returns a pretty printed string representation of an Defclass
481
646
 
@@ -484,8 +649,19 @@ CLIPS::Environment::Defclass.pp_form(defclass)
484
649
  defclass.pp_form
485
650
  ```
486
651
 
487
- ### `CLIPS::Environment::Defclass.defmodule_name`
488
- ### `CLIPS::Environment::Defclass#defmodule_name`
652
+ #### `CLIPS::Environment::Defclass.slots` / `CLIPS::Environment::Defclass#slots`
653
+
654
+ Returns an array representing the slot names of a Defclass.
655
+ Pass `true` as an argument to get inherited slots, as well.
656
+
657
+ ```ruby
658
+ CLIPS::Environment::Defclass.slots(defclass)
659
+ defclass.slots
660
+ CLIPS::Environment::Defclass.slots(defclass, true)
661
+ defclass.slots(true)
662
+ ```
663
+
664
+ #### `CLIPS::Environment::Defclass.defmodule_name` / `CLIPS::Environment::Defclass#defmodule_name`
489
665
 
490
666
  Returns the name of the defmodule in which the defclass is defined
491
667
 
@@ -494,8 +670,7 @@ CLIPS::Environment::Defclass.defmodule_name(defclass)
494
670
  defclass.defmodule_name
495
671
  ```
496
672
 
497
- ### `CLIPS::Environment::Defclass.defmodule`
498
- ### `CLIPS::Environment::Defclass#defmodule`
673
+ #### `CLIPS::Environment::Defclass.defmodule` / `CLIPS::Environment::Defclass#defmodule`
499
674
 
500
675
  Returns the defmodule in which the defclass is defined
501
676
 
@@ -504,8 +679,7 @@ CLIPS::Environment::Defclass.defmodule(defclass)
504
679
  defclass.defmodule
505
680
  ```
506
681
 
507
- ### `CLIPS::Environment::Defclass.get_instance_list`
508
- ### `CLIPS::Environment::Defclass#get_instance_list`
682
+ #### `CLIPS::Environment::Defclass.get_instance_list` / `CLIPS::Environment::Defclass#get_instance_list`
509
683
 
510
684
  Return an array of Instances of the Defclass.
511
685
  Pass `true` as an argument to include instances of subclasses
@@ -518,8 +692,7 @@ defclass.get_instance_list
518
692
  defclass.get_instance_list(true)
519
693
  ```
520
694
 
521
- ### `CLIPS::Environment::Defclass.superclasses`
522
- ### `CLIPS::Environment::Defclass#superclasses`
695
+ #### `CLIPS::Environment::Defclass.superclasses` / `CLIPS::Environment::Defclass#superclasses`
523
696
 
524
697
  Return an array of superclasses of the Defclass.
525
698
  Pass `true` as an argument to include inherited superclasses.
@@ -531,8 +704,7 @@ defclass.superclasses
531
704
  defclass.superclasses(true)
532
705
  ```
533
706
 
534
- ### `CLIPS::Environment::Defclass.subclasses`
535
- ### `CLIPS::Environment::Defclass#subclasses`
707
+ #### `CLIPS::Environment::Defclass.subclasses` / `CLIPS::Environment::Defclass#subclasses`
536
708
 
537
709
  Return an array of subclasses of the Defclass.
538
710
  Pass `true` as an argument to include inherited subclasses.
@@ -544,36 +716,9 @@ defclass.subclasses
544
716
  defclass.subclasses(true)
545
717
  ```
546
718
 
547
- ### `CLIPS::Environment.find_defrule`
548
- ### `CLIPS::Environment#find_defrule`
719
+ ### Defrule Methods
549
720
 
550
- Finds a defrule by name and returns a CLIPS::Environment::Defrule object
551
-
552
- ```ruby
553
- CLIPS::Environment.find_defrule(:a)
554
- env.find_defrule("foo")
555
- ```
556
-
557
- ### `CLIPS::Environment.find_instance`
558
- ### `CLIPS::Environment#find_instance`
559
-
560
- Finds an instance by name and returns a CLIPS::Environment::Instance object.
561
- Can take an optional second and third argument for Defmodule or Demodule name
562
- and a boolean that represents whether or not the instance should be searched for
563
- in imported modules.
564
- If the second argument is `nil`, `find_instance` will search the current module only.
565
-
566
- ```ruby
567
- CLIPS::Environment.find_definstance(:a)
568
- env.find_definstance("foo")
569
- CLIPS::Environment.find_definstance(:a, :my_module)
570
- env.find_definstance("foo", "my_module")
571
- CLIPS::Environment.find_definstance(:a, :my_module, true)
572
- env.find_definstance("foo", nil, true)
573
- ```
574
-
575
- ### `CLIPS::Environment::Defrule.name`
576
- ### `CLIPS::Environment::Defrule#name`
721
+ #### `CLIPS::Environment::Defrule.name` / `CLIPS::Environment::Defrule#name`
577
722
 
578
723
  Returns the name of a defrule as a symbol
579
724
 
@@ -582,8 +727,7 @@ CLIPS::Environment::Defrule.name(defrule)
582
727
  defrule.name
583
728
  ```
584
729
 
585
- ### `CLIPS::Environment::Defrule.defmodule_name`
586
- ### `CLIPS::Environment::Defrule#defmodule_name`
730
+ #### `CLIPS::Environment::Defrule.defmodule_name` / `CLIPS::Environment::Defrule#defmodule_name`
587
731
 
588
732
  Returns the name of the defmodule in which the defrule is defined
589
733
 
@@ -592,8 +736,7 @@ CLIPS::Environment::Defrule.defmodule_name(defrule)
592
736
  defrule.defmodule_name
593
737
  ```
594
738
 
595
- ### `CLIPS::Environment::Defrule.defmodule`
596
- ### `CLIPS::Environment::Defrule#defmodule`
739
+ #### `CLIPS::Environment::Defrule.defmodule` / `CLIPS::Environment::Defrule#defmodule`
597
740
 
598
741
  Returns the defmodule in which the defrule is defined
599
742
 
@@ -602,8 +745,7 @@ CLIPS::Environment::Defrule.defmodule(defrule)
602
745
  defrule.defmodule
603
746
  ```
604
747
 
605
- ### `CLIPS::Environment::Defrule.is_deletable`
606
- ### `CLIPS::Environment::Defrule#is_deletable`
748
+ #### `CLIPS::Environment::Defrule.is_deletable` / `CLIPS::Environment::Defrule#is_deletable`
607
749
 
608
750
  Returns a boolean whether the Defrule is deletable or not
609
751
 
@@ -612,8 +754,7 @@ CLIPS::Environment::Defrule.is_deletable(defrule)
612
754
  defrule.is_deletable
613
755
  ```
614
756
 
615
- ### `CLIPS::Environment::Defrule.pp_form`
616
- ### `CLIPS::Environment::Defrule#pp_form`
757
+ #### `CLIPS::Environment::Defrule.pp_form` / `CLIPS::Environment::Defrule#pp_form`
617
758
 
618
759
  Returns a pretty printed string representation of the Defrule
619
760
 
@@ -622,8 +763,7 @@ CLIPS::Environment::Defrule.pp_form(defrule)
622
763
  defrule.pp_form
623
764
  ```
624
765
 
625
- ### `CLIPS::Environment::Defrule.has_breakpoint`
626
- ### `CLIPS::Environment::Defrule#has_breakpoint`
766
+ #### `CLIPS::Environment::Defrule.has_breakpoint` / `CLIPS::Environment::Defrule#has_breakpoint`
627
767
 
628
768
  Returns whether or not the rule has a breakpoint set
629
769
 
@@ -632,8 +772,7 @@ CLIPS::Environment::Defrule.has_breakpoint(defrule)
632
772
  defrule.has_breakpoint
633
773
  ```
634
774
 
635
- ### `CLIPS::Environment::Defrule.set_break`
636
- ### `CLIPS::Environment::Defrule#set_break`
775
+ #### `CLIPS::Environment::Defrule.set_break` / `CLIPS::Environment::Defrule#set_break`
637
776
 
638
777
  Sets a breakpoint on a rule
639
778
 
@@ -642,8 +781,7 @@ CLIPS::Environment::Defrule.set_break(defrule)
642
781
  defrule.set_break
643
782
  ```
644
783
 
645
- ### `CLIPS::Environment::Defrule.remove_break`
646
- ### `CLIPS::Environment::Defrule#remove_break`
784
+ #### `CLIPS::Environment::Defrule.remove_break` / `CLIPS::Environment::Defrule#remove_break`
647
785
 
648
786
  Returns whether or not it was able to remove a breakpoint from a rule
649
787
 
@@ -652,8 +790,7 @@ CLIPS::Environment::Defrule.remove_break(defrule)
652
790
  defrule.remove_break
653
791
  ```
654
792
 
655
- ### `CLIPS::Environment::Defrule.salience`
656
- ### `CLIPS::Environment::Defrule#salience`
793
+ #### `CLIPS::Environment::Defrule.salience` / `CLIPS::Environment::Defrule#salience`
657
794
 
658
795
  Returns the salience of a defrule
659
796
 
@@ -662,18 +799,9 @@ CLIPS::Environment::Defrule.salience(defrule)
662
799
  defrule.salience
663
800
  ```
664
801
 
665
- ### `CLIPS::Environment.find_defmodule`
666
- ### `CLIPS::Environment#find_defmodule`
667
-
668
- Finds a defmodule by name and returns a CLIPS::Environment::Defmodule object
669
-
670
- ```ruby
671
- CLIPS::Environment.find_defmodule(:a)
672
- env.find_defmodule("foo")
673
- ```
802
+ ### Defmodule Methods
674
803
 
675
- ### `CLIPS::Environment::Defmodule.name`
676
- ### `CLIPS::Environment::Defmodule#name`
804
+ #### `CLIPS::Environment::Defmodule.name` / `CLIPS::Environment::Defmodule#name`
677
805
 
678
806
  Returns the name of a defmodule as a symbol
679
807
 
@@ -682,8 +810,7 @@ CLIPS::Environment::Defmodule.name(defmodule)
682
810
  defmodule.name
683
811
  ```
684
812
 
685
- ### `CLIPS::Environment::Defmodule.pp_form`
686
- ### `CLIPS::Environment::Defmodule#pp_form`
813
+ #### `CLIPS::Environment::Defmodule.pp_form` / `CLIPS::Environment::Defmodule#pp_form`
687
814
 
688
815
  Returns a pretty printed string representation of the Defmodule
689
816
 
@@ -692,8 +819,7 @@ CLIPS::Environment::Defmodule.pp_form(defmodule)
692
819
  defmodule.pp_form
693
820
  ```
694
821
 
695
- ### `CLIPS::Environment::Defmodule.set_current`
696
- ### `CLIPS::Environment::Defmodule#set_current`
822
+ #### `CLIPS::Environment::Defmodule.set_current` / `CLIPS::Environment::Defmodule#set_current`
697
823
 
698
824
  Sets the Defmodule as the current module of the environment
699
825
 
@@ -702,8 +828,7 @@ CLIPS::Environment::Defmodule.set_current(defmodule)
702
828
  defmodule.set_current
703
829
  ```
704
830
 
705
- ### `CLIPS::Environment::Defmodule.get_fact_list`
706
- ### `CLIPS::Environment::Defmodule#get_fact_list`
831
+ #### `CLIPS::Environment::Defmodule.get_fact_list` / `CLIPS::Environment::Defmodule#get_fact_list`
707
832
 
708
833
  Return an array of Facts with deftemplates in the Defmodule
709
834
 
@@ -712,8 +837,7 @@ CLIPS::Environment::Defmodule.get_fact_list(defmodule)
712
837
  defmodule.get_fact_list
713
838
  ```
714
839
 
715
- ### `CLIPS::Environment::Defmodule.find_instance`
716
- ### `CLIPS::Environment::Defmodule#find_instance`
840
+ #### `CLIPS::Environment::Defmodule.find_instance` / `CLIPS::Environment::Defmodule#find_instance`
717
841
 
718
842
  Finds an instance by name and returns a CLIPS::Environment::Instance object.
719
843
  Can take an optional second argument
@@ -727,106 +851,36 @@ CLIPS::Environment::Defmodule.find_instance(:a, true)
727
851
  defmodule.find_instance("foo", true)
728
852
  ```
729
853
 
730
- ### `CLIPS::Environment.get_defclass_list`
731
- ### `CLIPS::Environment#get_defclass_list`
732
-
733
- Return an array of Defclass names as symbols in the environment. Pass an argument of a
734
- symbol, string, or Defmodule object in order to only get Defclasss
735
- in that Defmodule. If you do not, it will return all Defclass names in all modules.
736
-
737
- ```ruby
738
- CLIPS::Environment.get_defclass_list(env)
739
- env.get_defclass_list
740
- CLIPS::Environment.get_defclass_list(env, :MAIN)
741
- env.get_defclass_list(:MAIN)
742
- CLIPS::Environment.get_defclass_list(env, defmodule)
743
- env.get_defclass_list(defmodule)
744
- ```
745
-
746
- ### `CLIPS::Environment.get_instance_list`
747
- ### `CLIPS::Environment#get_instance_list`
748
-
749
- Return an array of Instances in the environment. Pass an argument of a
750
- symbol, string, or Defclass object in order to only get Instances
751
- in that Defclass. If you do not, it will return all Instances of all Defclasses.
752
- If you do, you may also pass `true` as the second argument
753
- to include instances of subclasses of this Defclass.
754
-
755
- ```ruby
756
- CLIPS::Environment.get_instance_list(env)
757
- env.get_instance_list
758
- CLIPS::Environment.get_instance_list(env, :foo_class)
759
- env.get_instance_list(:"my-class")
760
- CLIPS::Environment.get_instance_list(env, defclass)
761
- env.get_instance_list(defclass)
762
- CLIPS::Environment.get_instance_list(env, defclass, true)
763
- env.get_instance_list(defclass, true)
764
- ```
765
-
766
- ### `CLIPS::Environment.get_deftemplate_list`
767
- ### `CLIPS::Environment#get_deftemplate_list`
768
-
769
- Return an array of Deftemplate names as symbols in the environment. Pass an argument of a
770
- symbol, string, or Defmodule object in order to only get Deftemplates
771
- in that Defmodule. If you do not, it will return all Deftemplate names in all modules.
772
-
773
- ```ruby
774
- CLIPS::Environment.get_deftemplate_list(env)
775
- env.get_deftemplate_list
776
- CLIPS::Environment.get_deftemplate_list(env, :MAIN)
777
- env.get_deftemplate_list(:MAIN)
778
- CLIPS::Environment.get_deftemplate_list(env, defmodule)
779
- env.get_deftemplate_list(defmodule)
780
- ```
781
-
782
- ### `CLIPS::Environment.get_defrule_list`
783
- ### `CLIPS::Environment#get_defrule_list`
854
+ #### `CLIPS::Environment::Defmodule.get_defclass_list` / `CLIPS::Environment::Defmodule#get_defclass_list`
784
855
 
785
- Return an array of Defrule names as symbols in the environment. Pass an argument of a
786
- symbol, string, or Defmodule object in order to only get Defrules
787
- 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
788
857
 
789
858
  ```ruby
790
- CLIPS::Environment.get_defrule_list(env)
791
- env.get_defrule_list
792
- CLIPS::Environment.get_defrule_list(env, :MAIN)
793
- env.get_defrule_list(:MAIN)
794
- CLIPS::Environment.get_defrule_list(env, defmodule)
795
- env.get_defrule_list(defmodule)
859
+ CLIPS::Environment::Defmodule.get_defclass_list(defmodule)
860
+ defmodule.get_defclass_list
796
861
  ```
797
862
 
798
- ### `CLIPS::Environment.get_defmodule_list`
799
- ### `CLIPS::Environment#get_defmodule_list`
863
+ #### `CLIPS::Environment::Defmodule.get_deftemplate_list` / `CLIPS::Environment::Defmodule#get_deftemplate_list`
800
864
 
801
- Return an array of Defmodule names as symbols in the environment.
865
+ Return an array of Deftemplate names as symbols in the Defmodule
802
866
 
803
867
  ```ruby
804
- CLIPS::Environment.get_defmodule_list(env)
805
- env.get_defmodule_list
868
+ CLIPS::Environment::Defmodule.get_deftemplate_list(defmodule)
869
+ defmodule.get_deftemplate_list
806
870
  ```
807
871
 
808
- ### `CLIPS::Environment.find_deftemplate`
809
- ### `CLIPS::Environment#find_deftemplate`
872
+ #### `CLIPS::Environment::Defmodule.get_defrule_list` / `CLIPS::Environment::Defmodule#get_defrule_list`
810
873
 
811
- Finds a deftemplate by name and returns a CLIPS::Environment::Deftemplate object
874
+ Return an array of Defrule names as symbols in the Defmodule
812
875
 
813
876
  ```ruby
814
- CLIPS::Environment.find_deftemplate(:a)
815
- env.find_deftemplate("foo")
877
+ CLIPS::Environment::Defmodule.get_defrule_list(defmodule)
878
+ defmodule.get_defrule_list
816
879
  ```
817
880
 
818
- ### `CLIPS::Environment.find_defclass`
819
- ### `CLIPS::Environment#find_defclass`
820
-
821
- Finds a defclass by name and returns a CLIPS::Environment::Defclass object
822
-
823
- ```ruby
824
- CLIPS::Environment.find_defclass(:a)
825
- env.find_defclass("foo")
826
- ```
881
+ ### Deftemplate Methods
827
882
 
828
- ### `CLIPS::Environment::Deftemplate.name`
829
- ### `CLIPS::Environment::Deftemplate#name`
883
+ #### `CLIPS::Environment::Deftemplate.name` / `CLIPS::Environment::Deftemplate#name`
830
884
 
831
885
  Returns the name of a deftemplate as a symbol
832
886
 
@@ -835,8 +889,7 @@ CLIPS::Environment::Deftemplate.name(deftemplate)
835
889
  deftemplate.name
836
890
  ```
837
891
 
838
- ### `CLIPS::Environment::Deftemplate.pp_form`
839
- ### `CLIPS::Environment::Deftemplate#pp_form`
892
+ #### `CLIPS::Environment::Deftemplate.pp_form` / `CLIPS::Environment::Deftemplate#pp_form`
840
893
 
841
894
  Returns a pretty printed string representation of the Deftemplate
842
895
 
@@ -845,8 +898,7 @@ CLIPS::Environment::Deftemplate.pp_form(deftemplate)
845
898
  deftemplate.pp_form
846
899
  ```
847
900
 
848
- ### `CLIPS::Environment::Deftemplate.assert_hash`
849
- ### `CLIPS::Environment::Deftemplate#assert_hash`
901
+ #### `CLIPS::Environment::Deftemplate.assert_hash` / `CLIPS::Environment::Deftemplate#assert_hash`
850
902
 
851
903
  Asserts a hash in the clips environment that a Deftemplate is defined in.
852
904
  Returns the Fact object that was just asserted
@@ -856,8 +908,7 @@ CLIPS::Environment::Deftemplate.assert_hash(deftemplate, foo: :bar)
856
908
  deftemplate.assert_hash(foo: :bar)
857
909
  ```
858
910
 
859
- ### `CLIPS::Environment::Deftemplate.defmodule_name`
860
- ### `CLIPS::Environment::Deftemplate#defmodule_name`
911
+ #### `CLIPS::Environment::Deftemplate.defmodule_name` / `CLIPS::Environment::Deftemplate#defmodule_name`
861
912
 
862
913
  Returns the name of the defmodule in which the deftemplate is defined
863
914
 
@@ -866,8 +917,7 @@ CLIPS::Environment::Deftemplate.defmodule_name(deftemplate)
866
917
  deftemplate.defmodule_name
867
918
  ```
868
919
 
869
- ### `CLIPS::Environment::Deftemplate.defmodule`
870
- ### `CLIPS::Environment::Deftemplate#defmodule`
920
+ #### `CLIPS::Environment::Deftemplate.defmodule` / `CLIPS::Environment::Deftemplate#defmodule`
871
921
 
872
922
  Returns the defmodule in which the deftemplate is defined
873
923
 
@@ -876,8 +926,7 @@ CLIPS::Environment::Deftemplate.defmodule(deftemplate)
876
926
  deftemplate.defmodule
877
927
  ```
878
928
 
879
- ### `CLIPS::Environment::Deftemplate.slot_names`
880
- ### `CLIPS::Environment::Deftemplate#slot_names`
929
+ #### `CLIPS::Environment::Deftemplate.slot_names` / `CLIPS::Environment::Deftemplate#slot_names`
881
930
 
882
931
  Returns the slot names of a deftemplate as symbols
883
932
 
@@ -886,8 +935,7 @@ CLIPS::Environment::Deftemplate.slot_names(deftemplate)
886
935
  deftemplate.slot_names
887
936
  ```
888
937
 
889
- ### `CLIPS::Environment::Deftemplate.is_deletable`
890
- ### `CLIPS::Environment::Deftemplate#is_deletable`
938
+ #### `CLIPS::Environment::Deftemplate.is_deletable` / `CLIPS::Environment::Deftemplate#is_deletable`
891
939
 
892
940
  Returns a boolean whether the Deftemplate is deletable or not
893
941
 
@@ -896,8 +944,7 @@ CLIPS::Environment::Deftemplate.is_deletable(deftemplate)
896
944
  deftemplate.is_deletable
897
945
  ```
898
946
 
899
- ### `CLIPS::Environment::Deftemplate.is_implied`
900
- ### `CLIPS::Environment::Deftemplate#is_implied`
947
+ #### `CLIPS::Environment::Deftemplate.is_implied` / `CLIPS::Environment::Deftemplate#is_implied`
901
948
 
902
949
  Returns a boolean whether the Deftemplate is implied or not.
903
950
  If the fact is an ordered fact, the Deftemplate is implied.
@@ -908,8 +955,7 @@ CLIPS::Environment::Deftemplate.is_implied(deftemplate)
908
955
  deftemplate.is_implied
909
956
  ```
910
957
 
911
- ### `CLIPS::Environment::Deftemplate.slot_allowed_values`
912
- ### `CLIPS::Environment::Deftemplate#slot_allowed_values`
958
+ #### `CLIPS::Environment::Deftemplate.slot_allowed_values` / `CLIPS::Environment::Deftemplate#slot_allowed_values`
913
959
 
914
960
  Returns the allowed values for the slot of a deftemplate as symbols
915
961
 
@@ -918,8 +964,7 @@ CLIPS::Environment::Deftemplate.slot_allowed_values(deftemplate, :foo)
918
964
  deftemplate.slot_allowed_values('bar')
919
965
  ```
920
966
 
921
- ### `CLIPS::Environment::Deftemplate.slot_default_value`
922
- ### `CLIPS::Environment::Deftemplate#slot_default_value`
967
+ #### `CLIPS::Environment::Deftemplate.slot_default_value` / `CLIPS::Environment::Deftemplate#slot_default_value`
923
968
 
924
969
  Returns the default value(s) for the slot of a deftemplate as symbols
925
970
 
@@ -928,8 +973,7 @@ CLIPS::Environment::Deftemplate.slot_default_value(deftemplate, :foo)
928
973
  deftemplate.slot_default_value('bar')
929
974
  ```
930
975
 
931
- ### `CLIPS::Environment::Deftemplate.slot_types`
932
- ### `CLIPS::Environment::Deftemplate#slot_types`
976
+ #### `CLIPS::Environment::Deftemplate.slot_types` / `CLIPS::Environment::Deftemplate#slot_types`
933
977
 
934
978
  Returns the slot type(s) for the named slot of a deftemplate as symbols.
935
979
  Possible types are as follows:
@@ -953,8 +997,7 @@ CLIPS::Environment::Deftemplate.slot_types(deftemplate, :foo)
953
997
  deftemplate.slot_types('bar')
954
998
  ```
955
999
 
956
- ### `CLIPS::Environment::Deftemplate.slot_range`
957
- ### `CLIPS::Environment::Deftemplate#slot_range`
1000
+ #### `CLIPS::Environment::Deftemplate.slot_range` / `CLIPS::Environment::Deftemplate#slot_range`
958
1001
 
959
1002
  Returns the range of a named slot of a deftemplate as integers or symbols (in case of infinity).
960
1003
 
@@ -963,8 +1006,7 @@ CLIPS::Environment::Deftemplate.slot_range(deftemplate, :foo)
963
1006
  deftemplate.slot_range('bar')
964
1007
  ```
965
1008
 
966
- ### `CLIPS::Environment::Deftemplate.slot_cardinality`
967
- ### `CLIPS::Environment::Deftemplate#slot_cardinality`
1009
+ #### `CLIPS::Environment::Deftemplate.slot_cardinality` / `CLIPS::Environment::Deftemplate#slot_cardinality`
968
1010
 
969
1011
  Returns the cardinality of a named slot of a deftemplate as integers or symbols (in case of infinity).
970
1012
 
@@ -973,8 +1015,7 @@ CLIPS::Environment::Deftemplate.slot_cardinality(deftemplate, :foo)
973
1015
  deftemplate.slot_cardinality('bar')
974
1016
  ```
975
1017
 
976
- ### `CLIPS::Environment::Deftemplate.slot_existp`
977
- ### `CLIPS::Environment::Deftemplate#slot_existp`
1018
+ #### `CLIPS::Environment::Deftemplate.slot_existp` / `CLIPS::Environment::Deftemplate#slot_existp`
978
1019
 
979
1020
  Returns a boolean for whether or not the slot with a given name
980
1021
  exists on the Deftemplate.
@@ -984,8 +1025,7 @@ CLIPS::Environment::Deftemplate.slot_existp(deftemplate, :foo)
984
1025
  deftemplate.slot_existp('bar')
985
1026
  ```
986
1027
 
987
- ### `CLIPS::Environment::Deftemplate.slot_singlep`
988
- ### `CLIPS::Environment::Deftemplate#slot_singlep`
1028
+ #### `CLIPS::Environment::Deftemplate.slot_singlep` / `CLIPS::Environment::Deftemplate#slot_singlep`
989
1029
 
990
1030
  Returns a boolean for whether or not the slot with a given name
991
1031
  on the Deftemplate is a single slot.
@@ -995,8 +1035,7 @@ CLIPS::Environment::Deftemplate.slot_singlep(deftemplate, :foo)
995
1035
  deftemplate.slot_singlep('bar')
996
1036
  ```
997
1037
 
998
- ### `CLIPS::Environment::Deftemplate.slot_multip`
999
- ### `CLIPS::Environment::Deftemplate#slot_multip`
1038
+ #### `CLIPS::Environment::Deftemplate.slot_multip` / `CLIPS::Environment::Deftemplate#slot_multip`
1000
1039
 
1001
1040
  Returns a boolean for whether or not the slot with a given name
1002
1041
  on the Deftemplate is a multislot.
@@ -1006,8 +1045,7 @@ CLIPS::Environment::Deftemplate.slot_multip(deftemplate, :foo)
1006
1045
  deftemplate.slot_multip('bar')
1007
1046
  ```
1008
1047
 
1009
- ### `CLIPS::Environment::Deftemplate.slot_defaultp`
1010
- ### `CLIPS::Environment::Deftemplate#slot_defaultp`
1048
+ #### `CLIPS::Environment::Deftemplate.slot_defaultp` / `CLIPS::Environment::Deftemplate#slot_defaultp`
1011
1049
 
1012
1050
  Returns a symbol representing the type of default value a slot has
1013
1051
  on the Deftemplate. Possible return values are as follows:
@@ -1023,38 +1061,7 @@ CLIPS::Environment::Deftemplate.slot_defaultp(deftemplate, :foo)
1023
1061
  deftemplate.slot_defaultp('bar')
1024
1062
  ```
1025
1063
 
1026
- ### `CLIPS::Environment::Defmodule.get_defclass_list`
1027
- ### `CLIPS::Environment::Defmodule#get_defclass_list`
1028
-
1029
- Return an array of Defclass names as symbols in the Defmodule
1030
-
1031
- ```ruby
1032
- CLIPS::Environment::Defmodule.get_defclass_list(defmodule)
1033
- defmodule.get_defclass_list
1034
- ```
1035
-
1036
- ### `CLIPS::Environment::Defmodule.get_deftemplate_list`
1037
- ### `CLIPS::Environment::Defmodule#get_deftemplate_list`
1038
-
1039
- Return an array of Deftemplate names as symbols in the Defmodule
1040
-
1041
- ```ruby
1042
- CLIPS::Environment::Defmodule.get_deftemplate_list(defmodule)
1043
- defmodule.get_deftemplate_list
1044
- ```
1045
-
1046
- ### `CLIPS::Environment::Defmodule.get_defrule_list`
1047
- ### `CLIPS::Environment::Defmodule#get_defrule_list`
1048
-
1049
- Return an array of Defrule names as symbols in the Defmodule
1050
-
1051
- ```ruby
1052
- CLIPS::Environment::Defmodule.get_defrule_list(defmodule)
1053
- defmodule.get_defrule_list
1054
- ```
1055
-
1056
- ### `CLIPS::Environment.find_deffacts`
1057
- ### `CLIPS::Environment#find_deffacts`
1064
+ #### `CLIPS::Environment.find_deffacts` / `CLIPS::Environment#find_deffacts`
1058
1065
 
1059
1066
  Finds a deffacts by name and returns a CLIPS::Environment::Deffacts object
1060
1067
 
@@ -1063,8 +1070,9 @@ CLIPS::Environment.find_deffacts(:a)
1063
1070
  env.find_deffacts("foo")
1064
1071
  ```
1065
1072
 
1066
- ### `CLIPS::Environment::Deffacts.name`
1067
- ### `CLIPS::Environment::Deffacts#name`
1073
+ ### Deffacts Methods
1074
+
1075
+ #### `CLIPS::Environment::Deffacts.name` / `CLIPS::Environment::Deffacts#name`
1068
1076
 
1069
1077
  Returns the name of a deffacts as a symbol
1070
1078
 
@@ -1073,8 +1081,7 @@ CLIPS::Environment::Deffacts.name(deffacts)
1073
1081
  deffacts.name
1074
1082
  ```
1075
1083
 
1076
- ### `CLIPS::Environment::Deffacts.pp_form`
1077
- ### `CLIPS::Environment::Deffacts#pp_form`
1084
+ #### `CLIPS::Environment::Deffacts.pp_form` / `CLIPS::Environment::Deffacts#pp_form`
1078
1085
 
1079
1086
  Returns a pretty printed string representation of the Deffacts
1080
1087
 
@@ -1083,54 +1090,6 @@ CLIPS::Environment::Deffacts.pp_form(deffacts)
1083
1090
  deffacts.pp_form
1084
1091
  ```
1085
1092
 
1086
- ### `CLIPS::Environment.watch`
1087
- ### `env.watch`
1088
- ### `CLIPS::Environment.unwatch`
1089
- ### `env.unwatch`
1090
-
1091
- "Watch" or "Unwatch" a specific thing that happens in the CLIPS environment.
1092
- There are several things that may be watched (or unwatched) such that CLIPS will
1093
- report debugging information to `STDOUT`. This gem provides two ways to watch
1094
- or unwatch a debug item: either pass the watch item as a symbol to `watch` or
1095
- `unwatch`, or use the corresponding `watch_foo` or `unwatch_foo` methods where
1096
- `foo` is replaced by the watch item (as listed):
1097
-
1098
- ```ruby
1099
- :all
1100
- :facts
1101
- :instances
1102
- :slots
1103
- :rules
1104
- :activations
1105
- :messages
1106
- :message_handlers
1107
- :generic_functions
1108
- :methods
1109
- :deffunctions
1110
- :compilations
1111
- :statistics
1112
- :globals
1113
- :focus
1114
- ```
1115
-
1116
- ```ruby
1117
- CLIPS::Environment.watch_facts
1118
- env.watch_statistics
1119
- CLIPS::Environment.unwatch(:facts)
1120
- env.unwatch(:statistics)
1121
- ```
1122
-
1123
- ### `CLIPS::Environment.get_watch_state`
1124
- ### `env.get_watch_state`
1125
-
1126
- Returns a bool representing whether or not the given debug item
1127
- is currently being watched in the environment.
1128
-
1129
- ```ruby
1130
- CLIPS::Environment.get_watch_state(env, :facts)
1131
- env.get_watch_state(:methods)
1132
- ```
1133
-
1134
1093
  ## Running the tests
1135
1094
 
1136
1095
  Simply do `rake compile` and then `rake test` in order to run the tests.