Class: Omnes::Execution
- Inherits:
-
Object
- Object
- Omnes::Execution
- Defined in:
- lib/omnes/execution.rb
Overview
Execution of an Subscription
When an event is published, it executes all matching subscriptions. Every single execution is represented as an instance of this class. It contains the result value of the subscriptions along with helpful metadata as the time of the execution or a benchmark for it.
You'll most likely interact with this class for debugging or logging purposes through a Publication returned on Bus#publish.
Instance Attribute Summary collapse
-
#benchmark ⇒ Benchmark::Tms
readonly
Benchmark for the #subscription's callback.
-
#result ⇒ Any
readonly
The value returned by the #subscription's callback.
-
#subscription ⇒ Omnes::Subscription
readonly
The subscription to which the execution belongs.
-
#time ⇒ Time
readonly
Time of execution.
Instance Method Summary collapse
-
#initialize(subscription:, result:, benchmark:, time: Time.now.utc) ⇒ Execution
constructor
A new instance of Execution.
Constructor Details
#initialize(subscription:, result:, benchmark:, time: Time.now.utc) ⇒ Execution
Returns a new instance of Execution.
35 36 37 38 39 40 |
# File 'lib/omnes/execution.rb', line 35 def initialize(subscription:, result:, benchmark:, time: Time.now.utc) @subscription = subscription @result = result @benchmark = benchmark @time = time end |
Instance Attribute Details
#benchmark ⇒ Benchmark::Tms (readonly)
Benchmark for the #subscription's callback
27 28 29 |
# File 'lib/omnes/execution.rb', line 27 def benchmark @benchmark end |
#result ⇒ Any (readonly)
The value returned by the #subscription's callback
22 23 24 |
# File 'lib/omnes/execution.rb', line 22 def result @result end |
#subscription ⇒ Omnes::Subscription (readonly)
The subscription to which the execution belongs
17 18 19 |
# File 'lib/omnes/execution.rb', line 17 def subscription @subscription end |
#time ⇒ Time (readonly)
Time of execution
32 33 34 |
# File 'lib/omnes/execution.rb', line 32 def time @time end |