Class: Celluloid::Proxy::Async

Inherits:
AbstractCall show all
Defined in:
lib/celluloid/proxy/async.rb

Overview

A proxy which sends asynchronous calls to an actor

Instance Attribute Summary

Attributes inherited from AbstractCall

#mailbox

Instance Method Summary collapse

Methods inherited from AbstractCall

#__klass__, #eql?, #hash, #initialize, #inspect

Methods inherited from Abstract

#__class__

Constructor Details

This class inherits a constructor from Celluloid::Proxy::AbstractCall

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/celluloid/proxy/async.rb', line 3

def method_missing(meth, *args, &block)
  if @mailbox == ::Thread.current[:celluloid_mailbox]
    args.unshift meth
    meth = :__send__
  end
  if block_given?
    # FIXME: nicer exception
    raise "Cannot use blocks with async yet"
  end
  @mailbox << ::Celluloid::Call::Async.new(meth, args, block)
  self
end