Class: Concurrent::Actor::Behaviour::Awaits

Inherits:
Abstract
  • Object
show all
Defined in:
lib/concurrent-ruby-edge/concurrent/actor/behaviour/awaits.rb

Overview

Accepts ‘:await` messages. Which allows to wait on Actor to process all previously send messages.

actor << :a << :b
actor.ask(:await).wait # blocks until :a and :b are processed

Instance Attribute Summary

Attributes inherited from Abstract

#core, #subsequent

Instance Method Summary collapse

Methods inherited from Abstract

#broadcast, #initialize, #on_event, #pass, #reject_envelope

Methods included from InternalDelegations

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

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_envelope(envelope) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/awaits.rb', line 13

def on_envelope(envelope)
  if envelope.message == :await
    true
  else
    pass envelope
  end
end