Class: Mutant::Parallel::Worker

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/mutant/parallel/worker.rb

Overview

Parallel execution worker

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(attributes) ⇒ self

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.

Run worker

Parameters:

  • Hash<Symbol, (Hash<Symbol, Object] attributes)

    Object] attributes

Returns:

  • (self)

15
16
17
18
# File 'lib/mutant/parallel/worker.rb', line 15

def self.run(attributes)
  new(attributes).run
  self
end

Instance Method Details

#runself

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.

Worker loop

rubocop:disable Lint/Loop

Returns:

  • (self)

30
31
32
33
34
# File 'lib/mutant/parallel/worker.rb', line 30

def run
  begin
    parent.call(Actor::Message.new(:ready, mailbox.sender))
  end until handle(mailbox.receiver.call)
end