about processes and engines

‘rufus-decision’ csv decision tables

This is the latest episode of my move to Rufus of some of the OpenWFEru subprojects.

The ‘rufus-decision‘ gem contains a Ruby implementation of [CSV] decision tables.


sudo gem install -y rufus-decision

given that table :

you can have :

require 'rubygems'
require 'rufus/decision'

include Rufus

TABLE ="""



# Given a customer (a Hash instance directly, for 
# convenience), returns the name of the first 
# corresponding salesman.
def determine_salesperson (customer)


puts determine_salesperson(
    "age" => 72)
    # => thorsten

puts determine_salesperson(
    "age" => 25, "trait" => "rich")
    # => adeslky

puts determine_salesperson(
    "age" => 23, "trait" => "cheerful")
    # => adeslky

puts determine_salesperson(
    "age" => 25, "trait" => "maniac")
    # => adeslky

puts determine_salesperson(
    "age" => 44, "trait" => "maniac")
    # => espadas

(original here)

Nothing prevents you from directly using the CSV “view” of a Google spreasheet like this :

table =

More info at

Written by John Mettraux

January 28, 2008 at 8:04 am

Posted in csv, decision, ruby, rufus

4 Responses

Subscribe to comments with RSS.

  1. […] ruby decision tables update (2008/01/28) : I’ve packaged those ruby decision tables into their own “rufus-decision” gem. More at […]

  2. […] decision table quickstart Update : there is a new blog post covering this Ruby decision table subject, with updated […]

  3. […] conversation that followed the meeting was extremely interesting, I was asked about integration of decision tables into business processes (as decision services via a CsvParticipant) : “too bad you […]

  4. […] with 2 comments update : I implemented those decision tables as a ruby gem see this blog post. […]

Comments are closed.

%d bloggers like this: