Class: PyrRules::RulesEngine
- Inherits:
-
Object
- Object
- PyrRules::RulesEngine
- Defined in:
- app/rules/pyr_rules/rules_engine.rb
Class Method Summary collapse
Class Method Details
.handle_event(event) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/rules/pyr_rules/rules_engine.rb', line 11 def self.handle_event(event) event = event_from_string(event) if event.class == String # Get super event rules tooo? rules = PyrRules::Rule.where(events: "#{event[:klazz]}::#{event[:action]}" ).all rules.each do |rule| begin rule.process_rule(event) rescue Exception => e puts "\n\n ERROR ENCOUNTERED processing rule: #{rule.name} ==> #{e.}" puts e.backtrace end end end |
.reload_configuration ⇒ Object
5 6 7 8 9 |
# File 'app/rules/pyr_rules/rules_engine.rb', line 5 def self.reload_configuration events = PyrRules::EventConfigLoader.reload_events_dictionary actions = PyrRules::ActionHandler.reload_configuration {events: events, actions: actions} end |