Class: ErpRules::RulesEngine::Ruleby::Engine

Inherits:
Object
  • Object
show all
Extended by:
Ruleby
Defined in:
lib/erp_rules/rules_engine/ruleby/engine.rb

Overview

Adapter to invoke the Ruleby engine with a rulebook. Intended to be used with the RulesFacade class

Class Method Summary collapse

Class Method Details

.invoke(rule_book, context) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/erp_rules/rules_engine/ruleby/engine.rb', line 10

def self.invoke(rule_book, context)
  engine :engine do |e|
    rule_book.new(e).rules

    e.assert context
    e.match
    e.retract context
  end
  context
end