Class: FiniteMachine::AsyncCall Private
- Inherits:
-
Object
- Object
- FiniteMachine::AsyncCall
- Defined in:
- lib/finite_machine/async_call.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
An immutable asynchronouse call representation that wraps the Callable object
Used internally by MessageQueue to dispatch events
Instance Method Summary collapse
-
#dispatch ⇒ nil
private
Dispatch the event to the context.
-
#initialize(context, callable, *args, &block) ⇒ AsyncCall
constructor
Create asynchronous call instance.
Constructor Details
#initialize(context, callable, *args, &block) ⇒ AsyncCall
Create asynchronous call instance
22 23 24 25 26 27 28 |
# File 'lib/finite_machine/async_call.rb', line 22 def initialize(context, callable, *args, &block) @context = context @callable = callable @arguments = args.dup @block = block freeze end |
Instance Method Details
#dispatch ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Dispatch the event to the context
35 36 37 |
# File 'lib/finite_machine/async_call.rb', line 35 def dispatch @callable.call(@context, *@arguments, &@block) end |