clipsruby 0.0.8 → 0.0.9

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 +15 -0
  3. data/ext/clipsruby/clipsruby.c +21 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bca9526858c7578fb8f1347584b76bdf99c5f8f74d301554751941bd3e3dde8
4
- data.tar.gz: '018e3bd14394a440793cd5006c75e2ce6fa0e2395ec2c85304bcb2a4e7757118'
3
+ metadata.gz: ede586e45827a7552e087b61a6f454a0d5c0c779e9d94b34deb2b13d1c7b5846
4
+ data.tar.gz: d46fdf1c8b9efd85600c976d414d4919ad8cd3c27171d15685f5dc059dd7c1e3
5
5
  SHA512:
6
- metadata.gz: 77e80952f44f747a30e40ebdc433bf46734a5c48e172557c438ec84b94de91ba486ee7791974837442a229c401b06b56658fc33eb2dd9251c617ce3a4eadaab5
7
- data.tar.gz: ad93fe9c5b7803738e449a1b373cffde734c84baef745364cfe9f866a5585e82cd757fd750263d2ca02c204f1cff002eb69e04f955ab6fa80f75c7eca197a890
6
+ metadata.gz: 7a4ee2975ebcb75e69f6dd5efd2a3c4c3d9b1c31fdd27a1e3fcbc918342d894bcae35cacdfbfd7c3ecdd3535474ccefe456dcc7ff7fb571b7254c4baf78812e1
7
+ data.tar.gz: 689887738a961e056658085ef49b1aa52de1679a630db22f6ca8e5b57bd562a65e87574f4b1f5dd96a4caf957aad22311f434356d7a5ea59272674a790bd5d58
data/README.md CHANGED
@@ -4,6 +4,17 @@
4
4
 
5
5
  Use the CLIPS programming language from within Ruby
6
6
 
7
+ ## Installation/Usage
8
+
9
+ This is available as a Ruby gem:
10
+
11
+ ```
12
+ gem install clipsruby
13
+ ```
14
+
15
+ From there, you should be able to `require "clipsruby"` in your code
16
+ and use the below API as described.
17
+
7
18
  ## API
8
19
 
9
20
  ### `CLIPS.create_environment`
@@ -132,3 +143,7 @@ Returns the name of the Deftemplate for a fact as a symbol
132
143
  CLIPS::Environment::Fact.deftemplate_name(fact)
133
144
  fact.deftemplate_name
134
145
  ```
146
+
147
+ ## Running the tests
148
+
149
+ Simply do `rake compile` and then `rake test` in order to run the tests.
@@ -673,7 +673,7 @@ static VALUE clips_environment_fact_to_h(VALUE self)
673
673
  VALUE innerValue;
674
674
  GetFactSlot(fact, key.multifieldValue->contents[i].lexemeValue->contents, &value);
675
675
  CLIPSValue_to_VALUE(&value, &innerValue, &rbEnvironment);
676
- rb_hash_aset(hash, rb_str_new2(key.multifieldValue->contents[i].lexemeValue->contents), innerValue);
676
+ rb_hash_aset(hash, ID2SYM(rb_intern(key.multifieldValue->contents[i].lexemeValue->contents)), innerValue);
677
677
  }
678
678
 
679
679
  return hash;
@@ -684,6 +684,24 @@ static VALUE clips_environment_fact_static_to_h(VALUE self, VALUE rbFact)
684
684
  return clips_environment_fact_to_h(rbFact);
685
685
  }
686
686
 
687
+ static VALUE clips_environment_batch_star(VALUE self, VALUE path)
688
+ {
689
+ Environment *env;
690
+
691
+ TypedData_Get_Struct(self, Environment, &Environment_type, env);
692
+
693
+ if (BatchStar(env, StringValueCStr(path))) {
694
+ return Qtrue;
695
+ } else {
696
+ return Qfalse;
697
+ }
698
+ }
699
+
700
+ static VALUE clips_environment_static_batch_star(VALUE self, VALUE rbEnvironment, VALUE path)
701
+ {
702
+ return clips_environment_batch_star(rbEnvironment, path);
703
+ }
704
+
687
705
  void Init_clipsruby(void)
688
706
  {
689
707
  VALUE rbCLIPS = rb_define_module("CLIPS");
@@ -707,6 +725,8 @@ void Init_clipsruby(void)
707
725
  rb_define_method(rbEnvironment, "_eval", clips_environment_eval, 1);
708
726
  rb_define_singleton_method(rbEnvironment, "find_all_facts", clips_environment_static_find_all_facts, -1);
709
727
  rb_define_method(rbEnvironment, "find_all_facts", clips_environment_find_all_facts, -1);
728
+ rb_define_singleton_method(rbEnvironment, "batch_star", clips_environment_static_batch_star, 2);
729
+ rb_define_method(rbEnvironment, "batch_star", clips_environment_batch_star, 1);
710
730
 
711
731
  VALUE rbFact = rb_define_class_under(rbEnvironment, "Fact", rb_cObject);
712
732
  rb_define_singleton_method(rbFact, "deftemplate_name", clips_environment_fact_static_deftemplate_name, 1);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clipsruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Johnston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Calling the CLIPS programming language from within Ruby
14
14
  email: mrryanjohnston@gmail.com