Class: SaveYourDosh::Mangler
- Inherits:
-
Object
- Object
- SaveYourDosh::Mangler
- Defined in:
- lib/save_your_dosh/mangler.rb
Instance Method Summary collapse
-
#initialize ⇒ Mangler
constructor
A new instance of Mangler.
- #mangle_dynos! ⇒ Object
- #mangle_workers! ⇒ Object
Constructor Details
#initialize ⇒ Mangler
Returns a new instance of Mangler.
8 9 10 11 |
# File 'lib/save_your_dosh/mangler.rb', line 8 def initialize @config = SaveYourDosh.config @heroku = Heroku::API.new(api_key: @config.heroku['api_key']) end |
Instance Method Details
#mangle_dynos! ⇒ Object
13 14 15 16 17 18 |
# File 'lib/save_your_dosh/mangler.rb', line 13 def mangle_dynos! mangle! :dynos do |qty| load = SaveYourDosh::NewRelic.get_dynos_load qty + (load > @config.dynos['threshold'] ? 1 : -1) end end |
#mangle_workers! ⇒ Object
20 21 22 23 24 |
# File 'lib/save_your_dosh/mangler.rb', line 20 def mangle_workers! mangle! :workers do |qty| qty end end |