Throttler Ramaze helper

After reading Rails Plugin: Throttler I created a Throttler Ramaze Helper .

  • What is it for? ”...The throttling plugin monitors the load of your server and allows you to disable certain features of your app when the load is too high...”
  • How to use it?
    • Copy throttler.rb to {ramaze_gem_dir}/lib/ramaze/helper/throttler.rb
    • In your controllers code:
class MainController < Ramaze::Controller
  helper :throttler

  def index
    # (optional): override the threshold when calling throttled?()
    # unless throttled?(10.00) ...
    unless throttled?
      "Hello World" 
    else
      "Overloaded: #{current_load}" 
    end
  end

protected
  # (optional) set another threshold value
  def threshold
    5.00
  end
end

Thanks a lot to Kashia from #ramaze for the help.

Later I start thinking “Hm, maybe that one is better to be Rack middleware ...”. Maybe next try…