Module: HireFire::Backend

Included in:
Environment::Base
Defined in:
lib/hirefire/backend.rb,
lib/hirefire/backend/resque.rb,
lib/hirefire/backend/delayed_job.rb,
lib/hirefire/backend/resque/redis.rb,
lib/hirefire/backend/delayed_job/mongoid.rb,
lib/hirefire/backend/delayed_job/active_record.rb,
lib/hirefire/backend/delayed_job/active_record_2.rb

Defined Under Namespace

Modules: DelayedJob, Resque

Class Method Summary collapse

Class Method Details

.included(base) ⇒ nil

Load the correct module (ActiveRecord, Mongoid or Redis) based on which worker and backends are loaded

Currently supports:

- Delayed Job with ActiveRecord and Mongoid
- Resque with Redis

Returns:

  • (nil)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/hirefire/backend.rb', line 17

def self.included(base)

  ##
  # Delayed Job specific backends
  if defined?(::Delayed)
    if defined?(::Delayed::Backend::ActiveRecord::Job)
      if defined?(::ActiveRecord::Relation)
        base.send(:include, HireFire::Backend::DelayedJob::ActiveRecord)
      else
        base.send(:include, HireFire::Backend::DelayedJob::ActiveRecord2)
      end
    end

    if defined?(::Delayed::Backend::Mongoid::Job)
      base.send(:include, HireFire::Backend::DelayedJob::Mongoid)
    end
  end

  ##
  # Resque specific backends
  if defined?(::Resque)
    base.send(:include, HireFire::Backend::Resque::Redis)
  end
end