Class: Celluloid::Proxy::Sync
- Inherits:
-
AbstractCall
- Object
- Abstract
- AbstractCall
- Celluloid::Proxy::Sync
- Defined in:
- lib/celluloid/proxy/sync.rb
Overview
A proxy which sends synchronous calls to an actor
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from AbstractCall
Instance Method Summary collapse
Methods inherited from AbstractCall
#__klass__, #eql?, #hash, #initialize, #inspect
Methods inherited from Abstract
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
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/celluloid/proxy/sync.rb', line 7 def method_missing(meth, *args, &block) raise ::Celluloid::DeadActorError, "attempted to call a dead actor: #{meth}" unless @mailbox.alive? if @mailbox == ::Thread.current[:celluloid_mailbox] args.unshift meth meth = :__send__ # actor = Thread.current[:celluloid_actor] # actor = actor.behavior.subject.bare_object # return actor.__send__(*args, &block) end call = ::Celluloid::Call::Sync.new(::Celluloid.mailbox, meth, args, block) @mailbox << call call.value end |
Instance Method Details
#respond_to?(meth, include_private = false) ⇒ Boolean
3 4 5 |
# File 'lib/celluloid/proxy/sync.rb', line 3 def respond_to?(meth, include_private = false) __class__.instance_methods.include?(meth) || method_missing(:respond_to?, meth, include_private) end |