Sha256: c4a13d5a417a2386f2c80889cc36a7163921a1ccb2546b3dcc001a329655ba81

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

# encoding: utf-8

module FiniteMachine
  # An asynchronous messages proxy
  class AsyncProxy
    include Threadable
    include ThreadContext

    attr_threadsafe :context

    # Initialize an AsynxProxy
    #
    # @param [Object] context
    #   the context this proxy is associated with
    #
    # @api private
    def initialize(context)
      self.context = context
    end

    # Delegate asynchronous event to event queue
    #
    # @api private
    def method_missing(method_name, *args, &block)
      callable   = Callable.new(method_name)
      async_call = AsyncCall.new(context, callable, *args, &block)

      event_queue << async_call
    end
  end # AsyncProxy
end # FiniteMachine

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
finite_machine-0.10.2 lib/finite_machine/async_proxy.rb
finite_machine-0.10.1 lib/finite_machine/async_proxy.rb
finite_machine-0.10.0 lib/finite_machine/async_proxy.rb