Module: HireFire::Environment::ClassMethods

Defined in:
lib/hirefire/environment.rb

Overview

Class methods that will be added to the Delayed::Job and Resque::Job classes

Instance Method Summary collapse

Instance Method Details

#environmentHireFire::Environment::Heroku, ...

Returns the environment class method (containing an instance of the proper environment class) for either Delayed::Job or Resque::Job

If HireFire.configuration.environment is nil (the default) then it’ll auto-detect which environment to run in (either Heroku or Noop)

If HireFire.configuration.environment isn’t nil (explicitly set) then it’ll run in the specified environment (Heroku, Local or Noop)



66
67
68
69
70
71
72
73
74
# File 'lib/hirefire/environment.rb', line 66

def environment
  @environment ||= HireFire::Environment.const_get(
    if environment = HireFire.configuration.environment
      environment.to_s.camelize
    else
      ENV.include?('HEROKU_UPID') ? 'Heroku' : 'Noop'
    end
  ).new
end