lib/celluloid/proxy/future.rb in celluloid-0.17.0 vs lib/celluloid/proxy/future.rb in celluloid-0.17.1

- old
+ new

@@ -1,40 +1,36 @@ -module Celluloid - module Proxy - # A proxy which creates future calls to an actor - class Future < Abstract - attr_reader :mailbox +# A proxy which creates future calls to an actor +class Celluloid::Proxy::Future < Celluloid::Proxy::Abstract + attr_reader :mailbox - # Used for reflecting on proxy objects themselves - def __class__ - Proxy::Future - end + # Used for reflecting on proxy objects themselves + def __class__ + ::Celluloid::Proxy::Future + end - def initialize(mailbox, klass) - @mailbox = mailbox - @klass = klass - end + def initialize(mailbox, klass) + @mailbox = mailbox + @klass = klass + end - def inspect - "#<Celluloid::Proxy::Future(#{@klass})>" - end + def inspect + "#<Celluloid::Proxy::Future(#{@klass})>" + end - def method_missing(meth, *args, &block) - unless @mailbox.alive? - fail DeadActorError, "attempted to call a dead actor" - end + def method_missing(meth, *args, &block) + unless @mailbox.alive? + fail ::Celluloid::DeadActorError, "attempted to call a dead actor" + end - if block_given? - # FIXME: nicer exception - fail "Cannot use blocks with futures yet" - end + if block_given? + # FIXME: nicer exception + fail "Cannot use blocks with futures yet" + end - future = ::Celluloid::Future.new - call = Call::Sync.new(future, meth, args, block) + future = ::Celluloid::Future.new + call = ::Celluloid::Call::Sync.new(future, meth, args, block) - @mailbox << call + @mailbox << call - future - end - end + future end end