module Frigate::Operation::Worker

A module that allows operation to perform as a background job, using Sidekiq as BJ for now

Public Class Methods

included(base) click to toggle source

Included hook

# File lib/frigate/operation/worker.rb, line 6
def self.included(base)
        base.send(:include, Sidekiq::Worker) # TODO: this will work with any background gem.
        base.extend(ClassMethods)
end

Public Instance Methods

perform(params) click to toggle source

Method that runs operation mechanism. It's here because of Sidekiq::Worker needs it @param [Hash] params income parameters

# File lib/frigate/operation/worker.rb, line 38
def perform(params)
        run(deserialize_params(params))
end

Private Instance Methods

deserialize_params(params) click to toggle source

deserializes params @param [Hash] params

# File lib/frigate/operation/worker.rb, line 45
def deserialize_params(params)
        Hashie::Mash.new(params) # TODO: deserialize AR for e.g.
end