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)



62
63
64
65
66
67
68
69
70
# File 'lib/hirefire/environment.rb', line 62

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