Sha256: 3411ecf180bcae545650ff4f4803d23c37deef49d07f51ea7bcc8b2b2fe1fd66

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

# A proxy which creates future calls to an actor
class Celluloid::Proxy::Future < Celluloid::Proxy::AbstractCall
  def method_missing(meth, *args, &block)
    unless @mailbox.alive?
      fail ::Celluloid::DeadActorError, "attempted to call a dead actor: #{meth}"
    end

    if block_given?
      # FIXME: nicer exception
      fail "Cannot use blocks with futures yet"
    end

    future = ::Celluloid::Future.new
    call = ::Celluloid::Call::Sync.new(future, meth, args, block)

    @mailbox << call

    future
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
celluloid-0.17.4 lib/celluloid/proxy/future.rb
celluloid-0.18.0.pre lib/celluloid/proxy/future.rb
celluloid-0.17.3 lib/celluloid/proxy/future.rb