Module: Proletariat::ActorCommon

Included in:
Actor, PoolableActor
Defined in:
lib/proletariat/concurrency/actor_common.rb

Overview

Internal: Common behavior for actor base classes.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/proletariat/concurrency/actor_common.rb', line 4

def self.included(base)
  base.class_exec do
    def initialize(*args)
      starting if respond_to?(:starting)

      super

      started if respond_to?(:started)
    end
  end
end

Instance Method Details

#on_event(event) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/proletariat/concurrency/actor_common.rb', line 16

def on_event(event)
  if event == :terminated
    stopping if respond_to?(:stopping)

    cleanup if respond_to?(:cleanup)

    super

    stopped if respond_to?(:stopped)
  else
    super
  end
end