lib/backgrounder/workers/process_asset.rb in carrierwave_backgrounder-0.0.9 vs lib/backgrounder/workers/process_asset.rb in carrierwave_backgrounder-0.1.0

- old
+ new

@@ -1,24 +1,15 @@ # encoding: utf-8 module CarrierWave module Workers class ProcessAsset < Struct.new(:klass, :id, :column) - @queue = :process_asset - - if defined?(::Sidekiq) - include ::Sidekiq::Worker - - sidekiq_options :queue => @queue - end - def self.perform(*args) new(*args).perform end - def perform(*args) - set_args(*args) unless args.empty? + def perform resource = klass.is_a?(String) ? klass.constantize : klass record = resource.find id if record record.send(:"process_#{column}_upload=", true) @@ -26,14 +17,9 @@ record.send :"#{column}_processing=", nil record.save! end end end - - def set_args(klass, id, column) - self.klass, self.id, self.column = klass, id, column - end - end # ProcessAsset end # Workers end # Backgrounder