rules icon indicating copy to clipboard operation
rules copied to clipboard

Load rules from external file in Ruby

Open jgluna opened this issue 7 years ago • 3 comments

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.

jgluna avatar Feb 07 '18 17:02 jgluna

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 avatar Feb 08 '18 05:02 jruizgit

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.

jruizgit avatar Feb 12 '18 03:02 jruizgit

@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?

joegaudet avatar Apr 09 '21 18:04 joegaudet