lib/cloudist/worker.rb in cloudist-0.4.4 vs lib/cloudist/worker.rb in cloudist-0.5.0
- old
+ new
@@ -1,38 +1,38 @@
module Cloudist
class Worker
-
+
attr_reader :job, :queue, :payload
-
+
def initialize(job, queue)
@job, @queue, @payload = job, queue, job.payload
-
+
# Do custom initialization
self.setup if self.respond_to?(:setup)
end
-
+
def data
job.data
end
-
+
def headers
job.headers
end
-
+
def id
job.id
end
-
+
def process
raise NotImplementedError, "Your worker class must subclass this method"
end
-
+
def log
Cloudist.log
end
-
+
end
-
+
class GenericWorker < Worker
def process(&block)
instance_eval(&block)
end
end