lib/celluloid/actor_proxy.rb in celluloid-0.1.0 vs lib/celluloid/actor_proxy.rb in celluloid-0.2.0
- old
+ new
@@ -33,10 +33,15 @@
def inspect
return __call :inspect if alive?
"#<Celluloid::Actor(#{@actor.class}:0x#{@actor.object_id.to_s(16)}) dead>"
end
+ # Create a Celluloid::Future which calls a given method
+ def future(method_name, *args, &block)
+ Celluloid::Future.new { __call method_name, *args, &block }
+ end
+
# Terminate the associated actor
def terminate
raise DeadActorError, "actor already terminated" unless alive?
terminate!
end
@@ -60,9 +65,13 @@
return # casts are async and return immediately
end
__call(meth, *args, &block)
end
+
+ #######
+ private
+ #######
# Make a synchronous call to the actor we're proxying to
def __call(meth, *args, &block)
our_mailbox = Thread.current.mailbox
call = SyncCall.new(our_mailbox, meth, args, block)
\ No newline at end of file