Class: Concurrent::Actor::Behaviour::TerminatesChildren

Inherits:
Abstract
  • Object
show all
Defined in:
lib/concurrent/actor/behaviour/terminates_children.rb

Overview

Terminates all children when the actor terminates.

Instance Attribute Summary

Attributes inherited from Abstract

#core, #subsequent

Instance Method Summary collapse

Methods inherited from Abstract

#broadcast, #initialize, #on_envelope, #pass, #reject_envelope

Methods included from InternalDelegations

#behaviour, #behaviour!, #children, #context, #dead_letter_routing, #log, #redirect, #terminate!

Methods included from PublicDelegations

#context_class, #executor, #name, #parent, #path, #reference

Methods included from TypeCheck

#Child!, #Child?, #Match!, #Match?, #Type!, #Type?

Constructor Details

This class inherits a constructor from Concurrent::Actor::Behaviour::Abstract

Instance Method Details

#on_event(event) ⇒ Object



6
7
8
9
# File 'lib/concurrent/actor/behaviour/terminates_children.rb', line 6

def on_event(event)
  children.map { |ch| ch.ask :terminate! }.each(&:wait) if event == :terminated
  super event
end