It seems to me that I'm going to invent a wheel here, so before I do this ...
I have a large set of data that I need to process, and the "rules" that process the data will change over time, so I thought that implementing a simple rule engine would be fine.
Note I'm not looking for a natural language parser , I want all the rules to be ruby ββprocs.
I could imagine that the syntax looks something like this:
engine = SimpleRulesEngine.new rule = engine.add_rule(priority: 10) do |row| row.name != 'George' end rule.action do |row| puts "Yikes, name is not George!, it was #{row.name}" row.update_attribute :name, 'George' end engine.process collection
I was wondering if there are any existing patterns or gems to help with this. The one that seems closest is ruleby , but doesn't seem to be actively supported and seems to be too complicated a solution for my problem.
Thanks!
Note that this is a similar question: Ruby and Rules Engines , but unlike that, I don't care about natural language processing and storing rules.
Jonathan
source share