Sha256: b243ec085896062fe72ebb58dc5cc18d51e03da33364ce558d82863a7f8d7a09
Contents?: true
Size: 832 Bytes
Versions: 9
Compression:
Stored size: 832 Bytes
Contents
require "scorpion/nest" module Scorpion module Rails # Adds a scorpion nest to support injection into rails background worker jobs. module Job def self.included( base ) # Setup dependency injection base.send :include, Scorpion::Object base.send :include, Scorpion::Rails::Nest base.send :around_perform, :with_scorpion super end private def prepare_scorpion( scorpion ) scorpion.prepare do |hunter| hunter.hunt_for ActiveJob::Base do self end end end attr_reader :scorpion def assign_scorpion( scorpion ) @scorpion = scorpion end def free_scorpion @scorpion.try( :destroy ) @scorpion = nil end end end end
Version data entries
9 entries across 9 versions & 1 rubygems