Class: Concurrent::Actor::Behaviour::Abstract
- Inherits:
-
Object
- Object
- Concurrent::Actor::Behaviour::Abstract
- Includes:
- InternalDelegations, TypeCheck
- Defined in:
- lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb
Direct Known Subclasses
Awaits, Buffer, ErrorsOnUnknownMessage, ExecutesContext, Linking, Pausing, RemovesChild, SetResults, Supervising, Termination
Instance Attribute Summary collapse
- #core ⇒ Object readonly
- #subsequent ⇒ Object readonly
Instance Method Summary collapse
-
#broadcast(public, event) ⇒ Object
broadcasts event to all behaviours and context.
-
#initialize(core, subsequent, core_options) ⇒ Abstract
constructor
A new instance of Abstract.
-
#on_envelope(envelope) ⇒ Object
override to add extra behaviour.
-
#on_event(public, event) ⇒ Object
override to add extra behaviour.
- #pass(envelope) ⇒ Object
- #reject_envelope(envelope) ⇒ Object
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
Instance Attribute Details
#core ⇒ Object (readonly)
12 13 14 |
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 12 def core @core end |
#subsequent ⇒ Object (readonly)
12 13 14 |
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 12 def subsequent @subsequent end |
Instance Method Details
#broadcast(public, event) ⇒ Object
broadcasts event to all behaviours and context
39 40 41 |
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 39 def broadcast(public, event) core.broadcast(public, event) end |
#on_envelope(envelope) ⇒ Object
Note:
super needs to be called not to break the chain
override to add extra behaviour
21 22 23 |
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 21 def on_envelope(envelope) pass envelope end |
#on_event(public, event) ⇒ Object
Note:
super needs to be called not to break the chain
override to add extra behaviour
32 33 34 |
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 32 def on_event(public, event) subsequent.on_event public, event if subsequent end |
#pass(envelope) ⇒ Object
26 27 28 |
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 26 def pass(envelope) subsequent.on_envelope envelope end |
#reject_envelope(envelope) ⇒ Object
43 44 45 46 47 |
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 43 def reject_envelope(envelope) envelope.reject! ActorTerminated.new(reference) dead_letter_routing << envelope unless envelope.future log(DEBUG) { "rejected #{envelope.} from #{envelope.sender_path}"} end |