Class: Spinoza::Event
- Inherits:
-
Object
- Object
- Spinoza::Event
- Defined in:
- lib/spinoza/system/timeline.rb
Overview
Events are the way we model the passage of time in a concurrent system. An event action initiates some action at some time. The action happens instantaneously on the timeline, except by scheduling later events.
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#actor ⇒ Object
readonly
Returns the value of attribute actor.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #dispatch ⇒ Object
-
#initialize(time: raise, actor: raise, action: raise, **data) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(time: raise, actor: raise, action: raise, **data) ⇒ Event
Returns a new instance of Event.
12 13 14 |
# File 'lib/spinoza/system/timeline.rb', line 12 def initialize time: raise, actor: raise, action: raise, **data @time, @actor, @action, @data = time, actor, action, data end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
8 9 10 |
# File 'lib/spinoza/system/timeline.rb', line 8 def action @action end |
#actor ⇒ Object (readonly)
Returns the value of attribute actor.
8 9 10 |
# File 'lib/spinoza/system/timeline.rb', line 8 def actor @actor end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/spinoza/system/timeline.rb', line 8 def data @data end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
8 9 10 |
# File 'lib/spinoza/system/timeline.rb', line 8 def time @time end |
Instance Method Details
#dispatch ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/spinoza/system/timeline.rb', line 16 def dispatch if data.empty? actor.send action else actor.send action, **data end end |