Class: Heroku::Autoscale
- Inherits:
-
Object
- Object
- Heroku::Autoscale
- Defined in:
- lib/heroku/autoscale.rb
Constant Summary collapse
- VERSION =
"0.2.6"
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#last_scaled ⇒ Object
readonly
Returns the value of attribute last_scaled.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Autoscale
constructor
A new instance of Autoscale.
Constructor Details
#initialize(app, options = {}) ⇒ Autoscale
Returns a new instance of Autoscale.
12 13 14 15 16 17 |
# File 'lib/heroku/autoscale.rb', line 12 def initialize(app, ={}) @app = app @options = .merge() @last_scaled = Time.now - 60 end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/heroku/autoscale.rb', line 10 def app @app end |
#last_scaled ⇒ Object (readonly)
Returns the value of attribute last_scaled.
10 11 12 |
# File 'lib/heroku/autoscale.rb', line 10 def last_scaled @last_scaled end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/heroku/autoscale.rb', line 10 def @options end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/heroku/autoscale.rb', line 19 def call(env) if [:defer] EventMachine.defer { autoscale(env) } else autoscale(env) end app.call(env) end |