Module: Delayed::Workless::Scaler::ClassMethods

Defined in:
lib/workless/scaler.rb

Instance Method Summary collapse

Instance Method Details

#scalerObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/workless/scaler.rb', line 21

def scaler
  @scaler ||= if ENV.include?("HEROKU_USER")
    client = ::Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD'])
    case client.info(ENV["APP_NAME"])[:stack]
    when "cedar"
      Scaler::HerokuCedar
    else  
      Scaler::Heroku
    end
  else
    Scaler::Local
  end
end

#scaler=(scaler) ⇒ Object



35
36
37
# File 'lib/workless/scaler.rb', line 35

def scaler=(scaler)
  @scaler = "Delayed::Workless::Scaler::#{scaler.to_s.camelize}".constantize
end