jruizgit / rules

Durable Rules Engine
MIT License
1.16k stars 206 forks source link

Load rules from external file in Ruby #139

Open jgluna opened 6 years ago

jgluna commented 6 years ago

Hi,

Is there any way to define the rules in an external file and load them in the engine? I don't see any example of dynamic loading in ruby.

Thanks.

jruizgit commented 6 years ago

Hi, thanks for posting the question. The ruby library has the same hooks as python and node.js. Let me put together the dynamic loading sample within the next couple of days.

jruizgit commented 6 years ago

Hi, I have added the testdynamic example for Ruby. These are the files for the example:

https://github.com/jruizgit/rules/tree/master/testrb/admin.html https://github.com/jruizgit/rules/tree/master/testrb/testdynamic.html
https://github.com/jruizgit/rules/tree/master/testrb/testdynamic.rb
https://github.com/jruizgit/rules/tree/master/testrb/durableVisual.js

You can try it by:

  1. Run ruby testrb/testdynamic.rb
  2. From your browser, navigate to http://localhost:4567/testdynamic.html
  3. Click save
  4. Click post

You should see a statechart on the right hand side. After clicking post, the state will change.

joegaudet commented 3 years ago

@jruizgit I'm not able to get the example above to run, It cannot find the Application::Interface which is maybe an old way of using sinatra?