I've tried the example code as presented in the documentation (with an unused object name defaulting to the parameter
object) like so:
%%% test.rb
require 'rubygems'
require 'rools'
rules=Rools::RuleSet.new do
rule "yello" do
parameter String
consequence {
puts parameter_object_shouldnt_be_nil
}
end
end
rules.assert "I'm not nil!"
%%%
And when I run this script in ruby, I get the following output:
% ruby test.rb
nil
% ...
This doesn't work as documented, and it's kind of upsetting if I can only fire rules knowing what kind of class it is.
The same problem appears in the condition {} blocks. Did method_missing change behaviours between versions or
something?
It's probably a simple fix. Is there a newer version than the gem (which is rools-0.2)? Where can I find it?
I like how you set up the domain-specific language here, and I don't like reinventing the wheel. ruby-rules, the other
rules engine, won't even run as a rubygem, so this is still a step up. |