Class: Onuro::Event
- Inherits:
-
Object
- Object
- Onuro::Event
- Includes:
- ExecutionResult, Loggable
- Defined in:
- lib/onuro/event.rb
Constant Summary
Constants included from ExecutionResult
Onuro::ExecutionResult::FAILURE, Onuro::ExecutionResult::NO_PROCESSABLE, Onuro::ExecutionResult::SUCCESSFUL
Instance Attribute Summary collapse
-
#event_strategy ⇒ Object
Returns the value of attribute event_strategy.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ruleset_stage ⇒ Object
readonly
Returns the value of attribute ruleset_stage.
Instance Method Summary collapse
- #add_rule_stage(rule_stage) ⇒ Object
- #add_ruleset_stage(ruleset_stage) ⇒ Object
- #execute(context = {}) ⇒ Object
-
#initialize(name, ruleset_stage: [], event_strategy: DefaultEventStrategy.new) ⇒ Event
constructor
A new instance of Event.
Methods included from Loggable
Constructor Details
#initialize(name, ruleset_stage: [], event_strategy: DefaultEventStrategy.new) ⇒ Event
Returns a new instance of Event.
17 18 19 20 21 |
# File 'lib/onuro/event.rb', line 17 def initialize(name, ruleset_stage: [], event_strategy: DefaultEventStrategy.new) self.name = name self.event_strategy = event_strategy @ruleset_stage = ruleset_stage end |
Instance Attribute Details
#event_strategy ⇒ Object
Returns the value of attribute event_strategy.
9 10 11 |
# File 'lib/onuro/event.rb', line 9 def event_strategy @event_strategy end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/onuro/event.rb', line 8 def name @name end |
#ruleset_stage ⇒ Object (readonly)
Returns the value of attribute ruleset_stage.
8 9 10 |
# File 'lib/onuro/event.rb', line 8 def ruleset_stage @ruleset_stage end |
Instance Method Details
#add_rule_stage(rule_stage) ⇒ Object
27 28 29 |
# File 'lib/onuro/event.rb', line 27 def add_rule_stage(rule_stage) ruleset_stage << rule_stage end |
#add_ruleset_stage(ruleset_stage) ⇒ Object
23 24 25 |
# File 'lib/onuro/event.rb', line 23 def add_ruleset_stage(ruleset_stage) @ruleset_stage += ruleset_stage end |
#execute(context = {}) ⇒ Object
31 32 33 34 |
# File 'lib/onuro/event.rb', line 31 def execute(context = {}) result = execution_flow(context) execution_result(SUCCESSFUL, result[:processed], result[:failed]) end |