Class: ProcessBot::Process::RunnerInstance
- Inherits:
-
Object
- Object
- ProcessBot::Process::RunnerInstance
- Defined in:
- lib/process_bot/process/runner_instance.rb
Instance Attribute Summary collapse
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
-
#initialize(runner:, event_queue:, logger:) ⇒ RunnerInstance
constructor
A new instance of RunnerInstance.
- #running? ⇒ Boolean
- #start ⇒ Object
Constructor Details
#initialize(runner:, event_queue:, logger:) ⇒ RunnerInstance
Returns a new instance of RunnerInstance.
4 5 6 7 8 |
# File 'lib/process_bot/process/runner_instance.rb', line 4 def initialize(runner:, event_queue:, logger:) @runner = runner @event_queue = event_queue @logger = logger end |
Instance Attribute Details
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
2 3 4 |
# File 'lib/process_bot/process/runner_instance.rb', line 2 def runner @runner end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
2 3 4 |
# File 'lib/process_bot/process/runner_instance.rb', line 2 def thread @thread end |
Instance Method Details
#running? ⇒ Boolean
21 22 23 |
# File 'lib/process_bot/process/runner_instance.rb', line 21 def running? runner.running? end |
#start ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/process_bot/process/runner_instance.rb', line 10 def start @thread = Thread.new do runner.run event_queue << {type: :stopped, runner_instance: self} rescue => e # rubocop:disable Style/RescueStandardError logger.error e. logger.error e.backtrace event_queue << {type: :error, runner_instance: self, error: e} end end |