Sha256: afad17ed6a110ec0089e34620e854722f152c5e92c3a10c4ece100be93a63517
Contents?: true
Size: 724 Bytes
Versions: 15
Compression:
Stored size: 724 Bytes
Contents
module Celluloid # A proxy which sends asynchronous calls to an actor class AsyncProxy < AbstractProxy attr_reader :mailbox # Used for reflecting on proxy objects themselves def __class__; AsyncProxy; end def initialize(mailbox, klass) @mailbox, @klass = mailbox, klass end def inspect "#<Celluloid::AsyncProxy(#{@klass})>" end 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 << AsyncCall.new(meth, args, block) end end end
Version data entries
15 entries across 13 versions & 5 rubygems