Class: Aggro::ConcurrentActor

Inherits:
Concurrent::Actor::RestartingContext
  • Object
show all
Defined in:
lib/aggro/concurrent_actor.rb

Overview

Private: Wraps a given target in an concurrent actor.

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ ConcurrentActor

Returns a new instance of ConcurrentActor.



4
5
6
# File 'lib/aggro/concurrent_actor.rb', line 4

def initialize(target)
  @target = target
end

Instance Method Details

#on_message(message) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/aggro/concurrent_actor.rb', line 8

def on_message(message)
  if command? message
    @target.send :apply_command, message
  elsif query? message
    @target.send :run_query, message
  end
end