Ruby & Rules Engines

 ̄綄美尐妖づ 提交于 2019-11-28 19:35:46
Ian Terrell

Take a look at Treetop. You can define your DSL as a Parsing Expression Grammar and then parse it to create your rules in whatever format you like.

Have a look at the wongi-engine gem it is a new rules engine based on the Rete algorithm that is gathering a fair bit of attention lately.

I don't know exactly how and on what objects these rules should be evaluated, but if these are ActiveRecord models maybe Ambition would be way to go. It let's you write conditions in ruby, something like:

User.select { |m| m.name == 'jon' && m.age == 21 }

This gets converted to SQL and you'll get all users satisfying the given criteria

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!