Sha256: 396be596bb496cca2fdf509716426cb8b32850d735eb79280a3ed218c5043fa8

Contents?: true

Size: 436 Bytes

Versions: 15

Compression:

Stored size: 436 Bytes

Contents

module Adrian
  class Worker
    attr_reader :item

    def initialize(item)
      @item = item
    end

    def report_to(boss)
      @boss = boss
    end

    def perform
      exception = nil

      begin
        work
      rescue Exception => e
        exception = e
      end

      @boss.work_done(item, self, exception) if @boss
    end

    def work
      raise "You need to implement #{self.class.name}#work"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
adrian-2.0.2 lib/adrian/worker.rb
adrian-2.0.1 lib/adrian/worker.rb
adrian-2.0.0 lib/adrian/worker.rb
adrian-1.5.0 lib/adrian/worker.rb
adrian-1.4.0 lib/adrian/worker.rb
adrian-1.3.3 lib/adrian/worker.rb
adrian-1.3.2 lib/adrian/worker.rb
adrian-1.3.1 lib/adrian/worker.rb
adrian-1.3.0 lib/adrian/worker.rb
adrian-1.2.0 lib/adrian/worker.rb
adrian-1.1.2 lib/adrian/worker.rb
adrian-1.1.1 lib/adrian/worker.rb
adrian-1.1.0 lib/adrian/worker.rb
adrian-1.0.1 lib/adrian/worker.rb
adrian-1.0.0 lib/adrian/worker.rb