class Adrian::Worker

Attributes

item[R]

Public Class Methods

new(item) click to toggle source
# File lib/adrian/worker.rb, line 5
def initialize(item)
  @item = item
end

Public Instance Methods

perform() click to toggle source
# File lib/adrian/worker.rb, line 13
def perform
  exception = nil

  begin
    work
  rescue Exception => e
    exception = e
  end

  @boss.work_done(item, self, exception) if @boss
end
report_to(boss) click to toggle source
# File lib/adrian/worker.rb, line 9
def report_to(boss)
  @boss = boss
end
work() click to toggle source
# File lib/adrian/worker.rb, line 25
def work
  raise "You need to implement #{self.class.name}#work"
end