diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-05-19 23:23:02 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-05-19 23:23:02 -0500 |
commit | 3a233d087a4221ad8822f70e2ae289ef7e543985 (patch) | |
tree | aa77d53751dbab75256b7c6ba20fbd1bb323e47f /lib/active_job/queue_adapters/sneakers_adapter.rb | |
parent | c6925f52d07a01c2b729a70bac60b11f7e514d76 (diff) | |
parent | 1b71fe59b8cd6c7347729703c064b64866b3502e (diff) | |
download | rails-3a233d087a4221ad8822f70e2ae289ef7e543985.tar.gz rails-3a233d087a4221ad8822f70e2ae289ef7e543985.tar.bz2 rails-3a233d087a4221ad8822f70e2ae289ef7e543985.zip |
Merge pull request #37 from Aesthetikx/master
Add Sneakers wrapper
Diffstat (limited to 'lib/active_job/queue_adapters/sneakers_adapter.rb')
-rw-r--r-- | lib/active_job/queue_adapters/sneakers_adapter.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/active_job/queue_adapters/sneakers_adapter.rb b/lib/active_job/queue_adapters/sneakers_adapter.rb new file mode 100644 index 0000000000..be400dc477 --- /dev/null +++ b/lib/active_job/queue_adapters/sneakers_adapter.rb @@ -0,0 +1,24 @@ +require 'sneakers' + +module ActiveJob + module QueueAdapters + class SneakersAdapter + class << self + def queue(job, *args) + JobWrapper.enqueue([job, *args]) + end + end + + class JobWrapper + include Sneakers::Worker + + self.from_queue("queue", {}) + + def work(*args) + job_name = args.shift + job_name.new.perform *Parameters.deserialize(args) + end + end + end + end +end |