Class: FiniteMachine::AsyncCall Private

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(context, callable, *args, &block) ⇒ AsyncCall

Create asynchronous call instance

Examples:

AsyncCall.new(context, Callable.new(:method), :a, :b)

Parameters:

  • context (Object)
  • callable (Callable)
  • args (Array)
  • block (#call)


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

#dispatchnil

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

Returns:

  • (nil)


35
36
37
# File 'lib/finite_machine/async_call.rb', line 35

def dispatch
  @callable.call(@context, *@arguments, &@block)
end