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 Method Summary collapse

Constructor Details

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

Instance Method Details

#on_envelope(envelope) ⇒ undocumented



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

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