Class: Concurrent::Actor::Behaviour::Abstract
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb |
Constant Summary
Concern::Logging
- Included
Class Method Summary
- .new(core, subsequent, core_options) ⇒ Abstract constructor
Instance Attribute Summary
Instance Method Summary
-
#broadcast(public, event)
broadcasts event to all behaviours and context.
-
#on_envelope(envelope)
override to add extra behaviour.
-
#on_event(public, event)
override to add extra behaviour.
- #pass(envelope)
- #reject_envelope(envelope)
Actor::InternalDelegations
- Included
#behaviour | see Core#behaviour |
#behaviour! | see Core#behaviour! |
#children, #context, #dead_letter_routing, | |
#log | delegates to core.log. |
#redirect, #terminate! |
Concern::Logging
- Included
#log | Logs through Concurrent.global_logger, it can be overridden by setting @logger. |
Actor::PublicDelegations
- Included
#actor_class | Alias for PublicDelegations#context_class. |
#context_class, #executor, #name, #parent, #path, | |
#ref | Alias for PublicDelegations#reference. |
#reference |
Actor::TypeCheck
- Included
Constructor Details
.new(core, subsequent, core_options) ⇒ Abstract
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 14
def initialize(core, subsequent, ) @core = Type! core, Core @subsequent = Type! subsequent, Abstract, NilClass end
Instance Attribute Details
#core (readonly)
[ GitHub ]# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 12
attr_reader :core, :subsequent
#subsequent (readonly)
[ GitHub ]# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 12
attr_reader :core, :subsequent
Instance Method Details
#broadcast(public, event)
broadcasts event to all behaviours and context
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 39
def broadcast(public, event) core.broadcast(public, event) end
#on_envelope(envelope)
Note:
super needs to be called not to break the chain
override to add extra behaviour
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 21
def on_envelope(envelope) pass envelope end
#on_event(public, event)
Note:
super needs to be called not to break the chain
override to add extra behaviour
# 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)
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 26
def pass(envelope) subsequent.on_envelope envelope end
#reject_envelope(envelope)
[ GitHub ]# 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