Class: Evostream::Event
- Inherits:
-
Object
- Object
- Evostream::Event
- Defined in:
- lib/evostream/event/event.rb
Overview
Reacts to event
Constant Summary collapse
- EVENTS =
Evostream::Events::Event.descendants
Instance Method Summary collapse
- #execute_action ⇒ Object
-
#initialize(type, payload) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(type, payload) ⇒ Event
Returns a new instance of Event.
10 11 12 13 |
# File 'lib/evostream/event/event.rb', line 10 def initialize(type, payload) @payload = payload @model = type.sub(/^(\w)/, &:capitalize) end |
Instance Method Details
#execute_action ⇒ Object
15 16 17 18 19 |
# File 'lib/evostream/event/event.rb', line 15 def execute_action klass = "Evostream::Events::#{@model}".constantize Evostream.logger "Execute Action : #{klass}" execute_klass(klass) if EVENTS.include?(klass) end |