Class: Wamp::Worker::Runner::Base
- Inherits:
-
Object
- Object
- Wamp::Worker::Runner::Base
- Defined in:
- lib/wamp/worker/runner.rb
Overview
This is a base class for all of the runners
Direct Known Subclasses
Instance Attribute Summary collapse
-
#dispatcher ⇒ Object
readonly
Returns the value of attribute dispatcher.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#_start ⇒ Object
region Override Methods.
- #_stop ⇒ Object
-
#active? ⇒ Boolean
Returns if the runner is active.
-
#initialize(name, uuid: nil) ⇒ Base
constructor
Constructor.
-
#logger ⇒ Object
Returns the logger.
-
#start ⇒ Object
Starts the runner.
-
#stop ⇒ Object
Stops the runner.
Constructor Details
#initialize(name, uuid: nil) ⇒ Base
Constructor
15 16 17 18 19 20 |
# File 'lib/wamp/worker/runner.rb', line 15 def initialize(name, uuid: nil) # Initialize the dispatcher @name = name || :default @dispatcher = Proxy::Dispatcher.new(self.name, uuid: uuid) @active = false end |
Instance Attribute Details
#dispatcher ⇒ Object (readonly)
Returns the value of attribute dispatcher.
10 11 12 |
# File 'lib/wamp/worker/runner.rb', line 10 def dispatcher @dispatcher end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/wamp/worker/runner.rb', line 10 def name @name end |
Instance Method Details
#_start ⇒ Object
region Override Methods
51 52 |
# File 'lib/wamp/worker/runner.rb', line 51 def _start end |
#_stop ⇒ Object
54 55 |
# File 'lib/wamp/worker/runner.rb', line 54 def _stop end |
#active? ⇒ Boolean
Returns if the runner is active
30 31 32 |
# File 'lib/wamp/worker/runner.rb', line 30 def active? @active end |
#logger ⇒ Object
Returns the logger
24 25 26 |
# File 'lib/wamp/worker/runner.rb', line 24 def logger Wamp::Worker.logger end |
#start ⇒ Object
Starts the runner
36 37 38 39 40 |
# File 'lib/wamp/worker/runner.rb', line 36 def start return if self.active? @active = true self._start end |
#stop ⇒ Object
Stops the runner
44 45 46 47 48 |
# File 'lib/wamp/worker/runner.rb', line 44 def stop return unless self.active? self._stop @active = false end |