Ruleby: The Rule Engine for Ruby
Written on December 7, 2007 by ceefour
Ruleby is a rule engine written in the Ruby language.
It is a system for executing a set of IF-THEN statements known as production rules. These rules are matched to objects using the forward chaining Rete algorithm. Ruleby provides an internal Domain Specific Language (DSL) for building the productions that make up a Ruleby program.
A rule engine is comprised of three parts:
- Facts – This is the data. It is known as the ‘working memory.
- Rules – the IF-THEN statements that define what valid data looks like
- Inference Engine – an efficient mechanism for executing the rules against the facts.
The Inference Engine in Ruleby is an implementation of the Rete algorithm. This is a forward chaining algorithm for matching patterns to objects. It was developed by Charles Forgy in his seminal paper Rete: a fast algorithm for the many pattern/many object pattern match problem.
How to use Ruleby?
Here is an example of a production rule in Ruleby (this example can be found in the Ruleby source code):
rule [Message, :m, m.status == :HELLO] do |e,v| puts v[:m].message v[:m].message = "Goodbye world" v[:m].status = :GOODBYE e.modify v[:m] end
For further details visit:
If you enjoyed this post Subscribe to our feed

Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)
December 9, 2007 at 8:03 pm
Ruleby: The Rule Engine for Ruby... It is a system for executing a set of IF-THEN statements known as production rules. ...
December 18, 2007 at 6:49 pm
[...] mais neste artigo e na página do [...]