Subscribe Favorite

Ruleby: The Rule Engine for Ruby

Written on December 7, 2007 by Eka Riyanti

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

5 Comments on “Ruleby: The Rule Engine for Ruby”

  1. PlugIM.com |

    Ruleby: The Rule Engine for Ruby…

    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 th…

  2. Ted |

    To: Eka Riyanti.

    Please stop copying the content of other people website. Wait, no, stop blogging at all. It’s called “plagiarism” or in your language “nyontek 100%”.

  3. Hendy Irawan |

    Dear Ted,

    I do respect your opinion.

    It’s true that we cite other people’s content, especially the ones that we think are valuable for us. We signify with quote the part of the linked sources that we find most interesting, and provide proper credit to these sites.

    By publishing these articles, we hope to provide value to our readers. We understand that a lot of people coming to Ruby on Rails aren’t even aware of many capabilities that Rails provides or that the community has already created.

    We aren’t asking readers to pay for us. Although we maintain this web site in our spare time, it’s great for us to hear suggestions from our readers. Let me know about the things you do prefer better.

  4. Ruleby : Ruby Brasil |

    […] mais neste artigo e na página do […]

  5. Ted |

    Hendy,

    First, you’re not “citing”, you’re stealing.

    Second, you’re not “publishing”, you’re “re-publishing” by way of stealing.

    Third, nobody will pay you guys anything for stealing content.

    Fourth, yes, a lot of people might not know much about Ruby on Rails. On the other hand, if you guys even know what “Ruleby” is, you wouldn’t copy paste other people content. I would’ve seen some of your own original thoughts of Ruleby had you actually know what Ruleby is. The fact that your content is 100% copy-paste even from the very first sentence proves how much you know the subject.

    How to make this website better? There are 2 ways, the easy way and the hard way.

    The easy way would be to stop stealing other people content.

    The hard way would be to write your own original content.

    PS: I often saw Indonesians copying other people content/work and claimed as his/hers on the internet. I’m ashamed of my own country due to these kind of actions.

    Merry Christmas.

Leave a Reply