README.md in railslove-rack-throttle-0.0.0 vs README.md in railslove-rack-throttle-0.0.1
- old
+ new
@@ -15,11 +15,11 @@
----------
There are two main differences:
* Throttling per minute => use Rack::Throttle::PerMinute, :max => 60
-* On reject callback => use Rack::Throttle::PerMinute, :max => 60, :on_reject => Proc.new { puts "Go Away!" }
+* On reject callback => use Rack::Throttle::PerMinute, :max => 60, :on_reject => Proc.new {|env| puts env.inspect }
Features
--------
* Throttles a Rack application by enforcing a minimum time interval between
@@ -109,10 +109,11 @@
use Rack::Throttle::Interval, :cache => Redis.new, :key_prefix => :throttle
### Using a callback when a visitor is rejected
# Can be anything that responds to #call
- callback = Proc.new { puts "help!" }
+ # We also pass "env" as an attribute e.g. object.call(env)
+ callback = Proc.new {|env| puts "help!" }
use Rack::Throttle::PerMinute, :max => 10, :on_reject => callback
Throttling Strategies
---------------------