Sha256: eacdff34f50a22e9cfc4aa42ce0159f3ec065170ada993ebaa9f0519581228f4

Contents?: true

Size: 503 Bytes

Versions: 2

Compression:

Stored size: 503 Bytes

Contents

module DeepTest
  class Worker
    attr_reader :number

    def initialize(number, blackboard, worker_listener)
      @number = number
      @blackboard = blackboard
      @listener = worker_listener
    end

    def run
      @listener.starting(self)
      while work_unit = @blackboard.take_work
        @listener.starting_work(self, work_unit)
        result = work_unit.run
        @listener.finished_work(self, work_unit, result)
        @blackboard.write_result result
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deep_test-1.1.3 lib/deep_test/worker.rb
deep_test-1.1.4 lib/deep_test/worker.rb