Sha256: a01430ade4182bdde1f590ef91b92102c830a9b811a937c315307e87951c1b28

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 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::Rails::Nest
        base.send :around_perform do |job, block|
          job.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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scorpion-ioc-0.4.0 lib/scorpion/rails/job.rb