Sha256: 73dfc9f89d16cd5349129e4d18a5369e0c3aa493fa71ee503a7ea812248fbf0a
Contents?: true
Size: 886 Bytes
Versions: 1
Compression:
Stored size: 886 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 do |job, block| job.send :with_scorpion, &block end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scorpion-ioc-0.5.2 | lib/scorpion/rails/job.rb |