Module: Concurrent::Actress::Context
- Includes:
- CoreDelegations, TypeCheck
- Defined in:
- lib/concurrent/actress/context.rb
Overview
module used to define actor behaviours
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#core ⇒ Object
readonly
Returns the value of attribute core.
Instance Method Summary collapse
- #children ⇒ Object
- #logger ⇒ Object
- #on_envelope(envelope) ⇒ Object private
-
#on_message(message) ⇒ Object
abstract
A result which will be used to set the IVar supplied to Reference#ask.
- #spawn(*args, &block) ⇒ Object
- #terminate! ⇒ Object
Methods included from CoreDelegations
#executor, #name, #parent, #path, #reference, #terminated, #terminated?
Methods included from TypeCheck
#Child!, #Child?, #Match!, #Match?, #Type!, #Type?
Instance Attribute Details
#core ⇒ Object (readonly)
Returns the value of attribute core.
18 19 20 |
# File 'lib/concurrent/actress/context.rb', line 18 def core @core end |
Instance Method Details
#children ⇒ Object
47 48 49 |
# File 'lib/concurrent/actress/context.rb', line 47 def children core.children end |
#logger ⇒ Object
29 30 31 |
# File 'lib/concurrent/actress/context.rb', line 29 def logger core.logger end |
#on_envelope(envelope) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 38 39 |
# File 'lib/concurrent/actress/context.rb', line 34 def on_envelope(envelope) @envelope = envelope envelope. ensure @envelope = nil end |
#on_message(message) ⇒ Object
This method is abstract.
override to define Actor’s behaviour
Note:
self should not be returned (or sent to other actors), Concurrent::Actress::CoreDelegations#reference should be used instead
Returns a result which will be used to set the IVar supplied to Reference#ask.
25 26 27 |
# File 'lib/concurrent/actress/context.rb', line 25 def () raise NotImplementedError end |
#spawn(*args, &block) ⇒ Object
42 43 44 |
# File 'lib/concurrent/actress/context.rb', line 42 def spawn(*args, &block) Actress.spawn(*args, &block) end |
#terminate! ⇒ Object
52 53 54 |
# File 'lib/concurrent/actress/context.rb', line 52 def terminate! core.terminate! end |