You could even get rid of the "if it meets some condition" when
asserting "i"
I believe some rules like this accomplish what you want:
rule [I, :i, m.some_method = "some condition"], [A, :a] do |v|
# then b
end
rule [I, :i, m.some_method = "some condition"], [:not, A] do |v|
# else c
end
rule [I, :i, m.some_method = "some condition"], [B, :b] do |v|
# then d
end
rule [I, :i, m.some_method = "some condition"], [:not, B] do |v|
# else e
end
The engine will take care of the redundant conditions - so they won't
be evaluate more than once. If you are really concerned about
repeating yourself, then you can take advantage of some patterns
consolidate repeated logic (like using a context object). But in
general I find that chaining rules like that defeats the purpose of
rulebook. When possible, I prefer each business rule to "mean what it
means." That way it is independent from the other rules. This makes
the rulebook easier to comprehend and maintain - in my opinion.
Joe