module Frigate::Operation::Worker::ClassMethods

Class methods of class that includes Worker module

Public Instance Methods

is_background?() click to toggle source

Whether or not operation is background @return [Boolean] either background or not

# 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 = {}) click to toggle source

Overrides standard run method in order to run an operation as a background job @param [Hash] params @param [Hash] options

# File lib/frigate/operation/worker.rb, line 16
def run(params, options = {})
        serialized_params = serialize_params(params)
        is_background? ? perform_async(serialized_params) : new.perform(serialized_params)
end

Private Instance Methods

serialize_params(params) click to toggle source

serializes params @param [Hash] params

# File lib/frigate/operation/worker.rb, line 31
def serialize_params(params)
        params # TODO: serialize AR for e.g.
end