Class: ActorSystem::Minimal::Actor::Proxy
- Inherits:
-
Object
- Object
- ActorSystem::Minimal::Actor::Proxy
show all
- Defined in:
- lib/actor_system/core/minimal.rb
Instance Method Summary
collapse
Constructor Details
#initialize(target) ⇒ Proxy
Returns a new instance of Proxy.
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/actor_system/core/minimal.rb', line 24
def initialize(target)
@target = target
@mailbox = Queue.new
@mutex = Mutex.new
@running = true
@async_proxy = AsyncProxy.new(self)
@thread = Thread.new do
Thread.current[:actor] = self
process_inbox
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
50
51
52
|
# File 'lib/actor_system/core/minimal.rb', line 50
def method_missing(meth, *args)
process_message(meth, *args)
end
|
Instance Method Details
38
39
40
|
# File 'lib/actor_system/core/minimal.rb', line 38
def async
@async_proxy
end
|
#send_later(meth, *args) ⇒ Object
42
43
44
|
# File 'lib/actor_system/core/minimal.rb', line 42
def send_later(meth, *args)
@mailbox << [meth, args]
end
|
#terminate ⇒ Object
46
47
48
|
# File 'lib/actor_system/core/minimal.rb', line 46
def terminate
@running = false
end
|