Module: Frigate::Operation::Worker::ClassMethods
- Defined in:
- lib/frigate/operation/worker.rb
Overview
Class methods of class that includes Worker module
Instance Method Summary collapse
-
#is_background? ⇒ Boolean
Whether or not operation is background.
-
#run(params, options = {}) ⇒ Object
Overrides standard run method in order to run an operation as a background job.
Instance Method Details
#is_background? ⇒ Boolean
Whether or not operation is background
23 24 25 26 |
# File 'lib/frigate/operation/worker.rb', line 23 def is_background? !(Rails.env.test? || Rails.env.cucumber?) || (!ENV['FRIGATE_WORKER'].nil? || ENV['FRIGATE_WORKER'].downcase == 'true') end |
#run(params, options = {}) ⇒ Object
Overrides standard run method in order to run an operation as a background job
16 17 18 19 |
# File 'lib/frigate/operation/worker.rb', line 16 def run(params, = {}) serialized_params = serialize_params(params) is_background? ? perform_async(serialized_params) : new.perform(serialized_params) end |